WinSCP can't upload file or folder with blank spaces

8,362

Wrap the name-with-space with double quote again.

winscp.com /command "option echo off" "option batch on" "option confirm off" "open sftp" "put ""C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_2012120172514\x y Report_P10_0010050075.xls"" ""/abc/MG0047/System Generated/x y Report_P10_0010050075.xls""" "exit"

Update: Updated the command.

Share:
8,362

Related videos on Youtube

Somalia
Author by

Somalia

Updated on September 18, 2022

Comments

  • Somalia
    Somalia almost 2 years

    I have created a batch file containing WinSCP commands to upload files in different folders. Now, file names and folder name contain blank spaces.

    It's showing an error when I'm running the batch file with those files and folders. The upload is successful when there aren't any blank spaces.

    Below is the batch command that I'm running:

    cd \
    cd C:\Program Files\WinSCP
    winscp.com /command "option echo off" "option batch on" "option confirm off" "open sftp" "put C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_2012120172514\x y Report_P10_0010050075.xls /abc/MG0047/System Generated/x y Report_P10_0010050075.xls" "exit"
    

    The error that I'm getting is:

    Cannot create remote file ' /Generated/x y Report_P10_0010050075.xls'.
    The file path does not exist or is invalid.
    Error Code:10
    Request code:3
    
  • Somalia
    Somalia over 12 years
    Tried using the above suggestion. Error coming is :Unknown command 'Generated\x y Report_P10_0010050075.xls'
  • Bibhas
    Bibhas over 12 years
    My bad. Had to add two extra quotes. Can you try now?
  • Somalia
    Somalia over 12 years
    Tried using double quotes.File or folder 'C:\abc\EXCEL\RestaurantAutomation\RestaurantReport_20121201 72514\x y Report_P10_0010050075' does not exist.
  • Martin Prikryl
    Martin Prikryl about 10 years
    The syntax with double double-quotes is explained here: winscp.net/eng/docs/commandline#syntax