GetListing() does not work with square brackets
Sorry. I did wrong testing. Updated.
When I use foldername has '[]', FluentFtp GetListing() function returns 1 item and item is self foldername. Ftp Server : Synology Client : Windows 10, .Net 4.5.2, FluentFtp 17.2.0
for example, (1) [].folder is empty folder. ftp.connect(); ftp.SetWorkingDirectory("/Temp/[].folder"); FtpListItem[] list = ftp.GetListing();
result : list.Count => 1 list[0].Name => [].folder list[0].Fullname => /Temp/[].folder/[].folder
*FtpListItem[] list = ftp.GetListing("/Temp/[].folder"); => same result. *WinSCP ftp Client works good.
(2) if filename has '[]', GetObjectInfo returns parent folder info.
Thank you for your help.
In my case, to avoid square brackets problem, use SetWorkingDirectory and GetList with NoPath option.
// example codes FtpClient ftp = ...;
string ftppath = "[].folder"; //string ftppath = "[a].folder";
FtpListItem[] list = null; if (path.Contains("[") && path.Contains("]")) { ftp.SetWorkingDirectory(ftppath); list = ftp.GetListing(null, FtpListOption.NoPath); } else { list = ftp.GetListing(ftppath); }
i have this problem too. and i used almost same workaround.
Same error
In my case
use this code
client.SetWorkingDirectory("/");
I solved
Works in V.40
using
FTP_Sess.SetWorkingDirectory("/home/mike");
FtpListItem[] Items = FTP_Sess.GetListing("", FtpListOption.ForceList | FtpListOption.NoPath);
you get
Fullname: "/home/mike/[].folder"
Name: "[].folder"
See Wiki path problems