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

martin

Re: Files with Spaces again

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.
djlutz

Files with Spaces again

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 sftp://%xyz%@feeds.clearstructure.com/ -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" ^
   "bye"


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?