Search code examples
ftpfilenameswinscpfilezilla

Synchronizing with WinSCP fails for FTP files with a leading space


I'm using WinSCP to synchronize a remote FTP directory to a local one, some files have leading space in their names, those files are not found for WinSCP with error

Error transferring file '/xml/ file.mask.some.file.xml.gz'
Copying files from remote side failed.
File not found

The command I'm using is:

C:\tools\winscp.com /command ^
    "option batch on" ^
    "option confirm off" ^
    "open ftp://user:password@server -certificate=""" ^
    "synchronize local ""D:\FTP\Data\PM"" ""/xml/"" -filemask=*file.mask.*.xml.gz>200D;" ^
    "exit"

How can I ignore this leading space when getting these files?


Solution

  • It looks like a server-side problem.

    You are using FileZilla FTP server 0.9.41 beta (2012-02-26). That version did not allow working with files with leading/trailing whitespaces. This was fixed in 0.9.43 (2014-01-02).

    Try updating your FileZilla FTP server to the latest version. I have no problem downloading a file with a leading space when using version 0.9.60.2.


    You also need to have a recent version of WinSCP (5.8 and later), as old versions did not allow working with files with leading spaces either.