Topic "Files with Spaces again"

Author Message
[View user's profile]

Joined: 2016-11-14
Posts: 1
Location: Metro Boston
I've reviewed many posts herein regarding this problem, but I believe I am doing it correctly.

I have a large Windows batch file that is used to download files from a remote server one-by-one.

The commands used follow:
  "C:\Program Files (x86)\winscp"\winscp.exe  /log=%logfile% /command "option batch abort" ^
   "option confirm off" ^
   "open s -hostkey=""ssh-rsa 1024 23:98:ad:a0:0f:d6:d0:bc:cb:bb:2b:f7:37:91:37:4c"""  ^
   "get -delete ""%remoteFolder%/%directory%/%file%"" %localRoot%\%directory%\" ^
   "close" ^

It uses several shell variables.
"xyz" is the user name and password
"remoteFolder" and "directory" is the path on the remote server
"localRoot" is the local path
"file" is the file name, which may or may not contain spaces. Nothing happens when the name contains a space.

I have looked at the log file. It appears that winscp never gets the full file name. For example, if the remote file name is "A B.txt", winscp only sees "A". At least, that's what it logs.

Any ideas?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
The variables are resolved by the batch file. So if a value is not resolved correctly, your question has actually nothing to do with WinSCP.

Anyway how do you set the variable? Show us more of your code. And WinSCP log file too.

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License