简体   繁体   English

c# FluentFTP,仅下载给定路径中的最后一个文件夹

[英]c# FluentFTP, download only the last folder in the given path

I'd like to download folder with c# FluentFTP library.我想下载带有 c# FluentFTP库的文件夹。 The folder is downloaded but I'd like to have in my machine only the last folder in the given path.该文件夹已下载,但我希望我的机器中只有给定路径中的最后一个文件夹。

List<FtpResult> res = client.DownloadDirectory(tmpFolder, "play_files\\test_folder\\", FtpFolderSyncMode.Update);
return res;

what I get in the local folder is a folder named play_files and a subfolder test_folder .我在本地文件夹中得到的是一个名为play_files的文件夹和一个子文件夹test_folder

what I want to get, is just one folder test_folder and I'd like to know if is it possible to rename it or not.我想要得到的只是一个文件夹test_folder ,我想知道是否可以重命名它。

I had the same issue and found the solution.我遇到了同样的问题并找到了解决方案。
For remoteFolder, start with '/'.对于 remoteFolder,以“/”开头。
For example, "/abc/def"not "abc/def".例如,“/abc/def”不是“abc/def”。

client.DownloadDirectory(@"D:\download", "/download/folder', FtpFolderSyncMode.Update, FtpLocalExists.Overwrite); client.DownloadDirectory(@"D:\download", "/download/folder', FtpFolderSyncMode.Update, FtpLocalExists.Overwrite);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM