FluentFTP
FluentFTP copied to clipboard
GetObjectInfo requires SetWorkingDirectory when retrieving info about a subfolder
FTP OS: Linux
FTP Server: Synology
Computer OS: Windows
FluentFTP Version: 34.02
When using GetObjectInfo(pathName) with pathname set to "user\test" or "\user\test", where 'user' is at the root of the server, no item is returned. FtpTrace reports:
Command: MLST user\test
Response: 550 user\test can't be listed
What works is:
var dirPath = Path.GetDirectoryName(pathName);
var dirName = Path.GetFileName(pathName);
_ftpClient.SetWorkingDirectory(dirPath);
_dirItem = _ftpClient.GetObjectInfo(dirName);
Is this a bug or is it supposed to work this way?
Logs :
None.
With all methods, providing a relative path (path that does NOT start with \
) will assume it works in the current directory. Relative paths are entirely subject to your FTP server. Try absolute paths like \user\test
instead.
I will reexamine this.
Relative paths are entirely subject to your FTP server
This is the key statement.
Command: MLST user\test
Response: 550 user\test can't be listed
It is the server that is rejecting the list command in that syntax. Other server types might accept it and understand it.
Processing relative paths needs some more code than just supporting absolute paths. Small footprint server might not implement this correctly or might not implement it at all.
Unless there is protest, I am closing this to clean up the issues.