发布网友 发布时间:2022-05-02 04:53
共2个回答
懂视网 时间:2022-05-02 09:14
public void fileRecursion(List<RFN.BM.OA.NetdiskDataInfo> netdiskDataInfoRecursions, string path)
{
var uploadFile = new NST.BL.STM.UploadFile();
var netdiskData = new RFN.BL.OA.NetdiskData();
foreach (var netdiskDataInfoRecursion in netdiskDataInfoRecursions)
{
if (netdiskDataInfoRecursion.FileSize == null)//通过FileSize 判断是文件还是文件夹
{
var pathDirectory = path + netdiskDataInfoRecursion.DataName + "\";
Directory.CreateDirectory(pathDirectory);//建立文件夹
}
else
{
string filePath = path + netdiskDataInfoRecursion.DataName;
var uploadFileInfo = uploadFile.SelectById(netdiskDataInfoRecursion.UploadFileId);
string uploadFilePath = @"D:WorkWork4RFNWebUploads" + uploadFileInfo.NewFileName;//本地Uploads路径
FileInfo filePathInfo = new FileInfo(filePath);
FileInfo uploadFilePathInfo = new FileInfo(uploadFilePath);
var filePathCreate = filePathInfo.Create();
filePathCreate.Close();
uploadFilePathInfo.CopyTo(filePath, true);//从上传文件中复制到建立好的文件夹中
}
}
foreach (var netdiskRecursion in netdiskDataInfoRecursions)
{
if (netdiskRecursion.FileSize == null)
{
netdiskDataInfoRecursions = netdiskData.SelectBy("[ParentId]=?", "[CreateTime]", netdiskRecursion.Id);
if (netdiskDataInfoRecursions != null)
{
path = path + netdiskRecursion.DataName + "\";
fileRecursion(netdiskDataInfoRecursions, path);//如果是文件夹且数据不为空,则继续调用此方法。
}
}
}
}
通过数据库数据构建文件夹结构的递归算法
标签:direct adf recursion director load list disk data info
热心网友 时间:2022-05-02 06:22
查找阿, 比如 说: dim lrs as new adodb.recordset