3

I am trying to copy a file from windows 7 to linux debian using SFTP Filename is ba ck.bak

I am using SFTP to remotely put file through windows command prompt If filename is back.bak then command executes successfully

sftp> sftpc [email protected]:xx -pw=XXXXX -cmd="put back.bak /tmp"

but if filename is ba ck.bak, i.e. with spaces error occurs I had tried using

-cmd="put 'ba ck.bak' /tmp"

but doesn't work

I am using this file in a windows batch file, so I cannot execute by logging into sftp session and executing command there. I can also execute these commands through shell file, but I would not want to create new file each time.

2 Answers 2

3

Okay, I got the answer on my own. Instead of searching all over the internet, I checked the help for the command, and got the answer in the examples:

sftpc [email protected]:xx -pw=XXXXX -cmd="put \"ba ck.bak\" /tmp"

Had to escape the qoutes.

0

You must cancel out those spaces using '\'. So your command would be,

sftp> sftpc [email protected]:xx -pw=XXXXX -cmd="put ba\ ck.bak /tmp"

That will make the shell not see the space in the file name.

1
  • I am sorry, but that doesn't work as expected. Terminates with "Invalid Command Option: /tmp" Oct 9, 2014 at 5:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .