Post a reply

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)


Topic review


Re: Re : Directory path having multiple space.

Please first start with a hard-coded path (without the %pathnameX% variables).
   "put ""Q:\Fall 2020\Department Stores\""" ^

If it does not work, post again your full script (with hard-coded path) and the log file.

Re : Directory path having multiple space.

Thanks Martin, for helping but that doesn't work. Getting below error while passing the value, seems like it's considering "Department stores" as a different folder while copying.

Are you sure you want to transfer multiple files to a single file 'Stores"' in a directory '/BIDATA/Testfolder'?
The files will overwrite one another.
If you actually want to transfer all files to a directory '/BIDATA/Testfolder/Stores"/', keeping their name, make sure you terminate the path with a slash.
File or folder 'Q:\Fall' does not exist.
System Error. Code: 2.

Directory path having multiple space.


I am writing a below script. Need help to fix quote issue for define path.
If i use below CODE1 everything work fine. But when i use CODE2 unable to get into sub directory path & get error. I try to adjust quote but still same issue.
As you can see ERROR it show single quote before "department" word. If i remove that from CODE2 set it as (set pathname1="Q:\"""Fall 2020\"""Department Stores"") it show error as ( File or folder 'Q:\Fall 2020\Department' does not exist.).
Let me know how can we fix this.

@echo off
set pathname0="Q:\"""Fall 2020\""
 "C:\Program Files (x86)\WinSCP\" ^
  /log="C:\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://***/ -hostkey=""ssh-*****="" -rawsettings FSProtocol=2" ^
   "cd /BIDATA/Testfolder" ^
   "put -filemask="*.xlsx" %pathname0%" ^
    "exit" ^

@echo off
set pathname1="Q:\"""Fall 2020\""""Department Stores""
"C:\Program Files (x86)\WinSCP\" ^
  /log="C:\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://*********/ -hostkey=""ssh-****"" -rawsettings FSProtocol=2" ^
   "cd /BIDATA/Testfolder/" ^
   "put %pathname1%" ^


Active session: [1] BITEAM@******
File or folder 'Q:\Fall 2020\"Department Stores' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort