简体   繁体   中英

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

I'd like to download folder with c# FluentFTP library. 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 .

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.

I had the same issue and found the solution.
For remoteFolder, start with '/'.
For example, "/abc/def"not "abc/def".

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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