从URL创建文件夹结构 [英] Create folder structure from URL

查看:145
本文介绍了从URL创建文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个名为ABC.txt的文本文件,其中包含导航到不同文件的不同URL。要求是从文本文件中读取URL并在本地驱动器中创建文件夹结构。

I've a text file named ABC.txt which contains different URLs navigating to different files. The requirement is to read URL from the text file and create folder structure in local drive.

假设URL为  http://XYZ.com/Teams/DEF/cer/MNO/ JKL.xlsx

根据上述URL,文件夹结构应为XYZ.com \Teams \DEF \cer \ MNO \,其中将下载文件JKL.xslx。下载工作正常,但我无法创建文件夹结构。

Suppose the URL is http://XYZ.com/Teams/DEF/cer/MNO/JKL.xlsx
Based on the above URL, the folder structure should be XYZ.com\Teams\DEF\cer\MNO\ in which file JKL.xslx will be downloaded. The download is working but I am unable to create the folder structure.

我试图将路径格式化为数组/ arraylist,但之后也是'http:'和'JKL.xslx'没有被删除,因为它是固定数组。即使尝试作为arraylist并试图删除这两个项目,整个阵列也被删除了。

I've tried to format the path as an array/arraylist but then also the portions such as 'http:' and 'JKL.xslx' are not getting removed as it's fixed array. Even trying as arraylist and trying to remove the 2 items, the entire array got removed.

如果你以前遇到过这样的事情,请分享你的经验。

Please share your experience if you've faced such things before.

谢谢,

Kunal

推荐答案

文件夹就像文件一样是文档库中的对象。 您的代码需要读取文件夹结构,检查文件夹是否已存在,如果不存在则创建文件夹。 没有办法传递路径并上传
自动创建文件夹结构。
Folders are objects in a document library just like files are.  YOur code will need to read the folder structure, check whether the folder already exists, and create the folder if it doesn't.  There is no way to pass a path and have the upload automatically create the folder structure.


这篇关于从URL创建文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆