Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

jpantera

Scripted file winscp.com method and files with embedded spaces

Hello Martin and WinSCP Support,

I'm trying to write an automation to pull a set of files, and the users generating those files seem to need to have an embedded space in the middle of them. Using winscp.com and a script file, this just doesn't work:

Try #1:

winscp> dir MyFile*
dir MyFile*
-rw-rwx--- 1 <XXXXXXX> <XX> 6895612 Jul 11 16:06:49 2024 MyFile01 060924-063024.csv
-rw-rwx--- 1 <XXXXXXX> <XX> 9325753 Jul 11 16:06:41 2024 MyFile02 060924-063024.csv
winscp> dir "MyFile01 060924-063024.csv"
dir "MyFile01 060924-063024.csv"
Error listing directory 'MyFile01 060924-063024.csv'.
No such file or directory.
Error code: 2
Error message from server: No such file
(A)bort, (R)etry, (S)kip: Abort

Try #2, other similar:

winscp> dir \"MyFile01 060924-063024.csv\""
dir \"MyFile01 060924-063024.csv\""
Error listing directory '\MyFile01 060924-063024.csv\"'.
No such file or directory.
Error code: 2
Error message from server: No such file
(A)bort, (R)etry, (S)kip: Abort

I know I've been able to escape the white spaces in the past by surrounding the file name, and path to the file with double-quotes, but that's not working with this site. I did write a wildcard type of script (to grab all files of this name in my get), that pulls more than the files I need to download down, and then I can ferret through them on my system, but can you please offer an example of how to handle this via winscp.com?

I do use Perl as my go-to language, and am able ot use Perl and the .NET Assembly to figure out the exact file names I need, but I'm unsure of the method with Perl and .NET Assembly to do the get on these files with these embedded spaces, so perhaps you could share that, as it's not show in documentation.

Thanks,
Joe P.