Topic "problem with space in folder name"

Author Message
surfer01

Guest


Hello,

i have the following problem. I use WinSCP with a scipt to synchronisize some folders to a webdrive. It works fine if the folder name does not include a space (like "Bilder"). If it includes a space (like "Eigene Bilder") it does not work and I cant´t change to this folder on the webspace. Any idea how to solve the problem?

Code:
@echo off
set pathname0="/users/XXXXXXX/Backup_PC/Laufwerk_J/Eigene Bilder/"


"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="K:\Test\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://xxxx:xxxx@sftp.hidrive.strato.com/ -hostkey=""ssh-rsa xxxx xx:xx:xx:Xx:xx:xx:xx:xx""" ^
    "cd %pathname0%" ^
   "synchronize remote J:\" ^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%


Regards
surfer
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26711
Location: Prague, Czechia
You have to quote the paths with spaces:

"cd ""%pathname0%""" ^

See https://winscp.net/eng/docs/commandline#syntax
_________________
Martin Prikryl
Guest




Hi Martin,

sorry, but that doesn´t work Sad I get this error message in the logfile:


Code:
> 2017-02-06 20:07:47.296 Script: cd "/users/xxxxx/Backup_PC/Laufwerk_J/Eigene
. 2017-02-06 20:07:47.296 Changing directory to "/users/xxxxx/Backup_PC/Laufwerk_J/Eigene".
. 2017-02-06 20:07:47.296 Getting real path for '/users/xxxxx/Backup_PC/Laufwerk_J/Eigene'
> 2017-02-06 20:07:47.296 Type: SSH_FXP_REALPATH, Size: 53, Number: 272
< 2017-02-06 20:07:47.374 Type: SSH_FXP_STATUS, Size: 29, Number: 272
< 2017-02-06 20:07:47.374 Status code: 2, Message: 272, Server: No such file, Language: 


Code:
set pathname0="/users/surfer-01/Backup_PC/Laufwerk_J/Eigene Bilder/"
"cd ""%pathname0%""" ^


Any other Idea?

Regards
surfer
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26711
Location: Prague, Czechia
OK, remove the quotes in the set command:

set pathname0=/users/XXXXXXX/Backup_PC/Laufwerk_J/Eigene Bilder/
Guest




that work´s! Thank you Very Happy
Advertisements

You can post new topics in this forum

Search

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License