Posted: 2015-11-06 18:35
[FTPFileSystem] Path argument for TFTPFileSystem::DoChangeDirectory is Filename instead of Directory
Error observed in WinSCP versions 575 and 576
Protocol Type: FTP
Server Type: AVM Fritz!Box Router Models (7170, 7050, 7360, 7490) all updated
Operation: Scripted getFiles(/Intenso-AluLine-01/folder/file.json)
File is present and can be transferred using the GUI
Operation section: STAT command
Normal behavior: STAT command, GET command
Session log snippet:
Listing file "/Intenso-AluLine-01/folder/file.json".
Retrieving file information...
257 "/Intenso-AluLine-01/folder" is current directory.
550 /Intenso-AluLine-01/folder/file.json: Not a directory.
200 Type set to I.
550 /Intenso-AluLine-01/folder/file.json: No such file or directory
Could not retrieve file information
Script: Can't get attributes of file '/Intenso-AluLine-01/folder/file.json'.
Script: Could not retrieve file information
/Intenso-AluLine-01/folder/file.json: No such file or directory
WinSCP seems to fetch remote file information any time a file is being downloaded
-> This leads to remote directory listing on certain servers
If a script knows that a file is present, would it be possible to disable file information retrieval by configureable boolean property?
-> This could help to reduce amount of transactions for managed remote file systems
-> This would also be a hotfix for the problem I encountered
After brief survey of the source, it seems that DoChangeDirectory is called with the filename as argument instead of the file's directory.
void __fastcall TFTPFileSystem::ChangeDirectory(const UnicodeString ADirectory)
UnicodeString Directory = ADirectory;
// For changing directory, we do not make paths absolute, instead we
// delegate this to the server, hence we synchronize current working
// directory with the server and only then we ask for the change with
// relative path.
// But if synchronization fails, typically because current working directory
// no longer exists, we fall back to out own resolution, to give
// user chance to leave the non-existing directory.
Directory = AbsolutePath(Directory, false);
// make next ReadCurrentDirectory retrieve actual server-side current directory
FReadCurrentDirectory = true;
Hopefully this information can be of some use, WinSCP really is a great software and thanks to the scripting interface it achieves an utmost degree of versatility.
Finally I'd be really thankful if it were possible to implement the property switch spoken of in order to improve efficiency in an automated usage scenario.
With kind regards,
On Model 7050
215 UNIX Type: L8 Version: Linux 18.104.22.168
Location: Prague, Czechia
Re: [FTPFileSystem] Path argument for TFTPFileSystem::DoChangeDirectory is Filename instead of Directory
The problem is not the
You can post new topics in this forum
And it's free!