Discussion:
sftp and escape characters
ross
2005-10-20 06:31:38 UTC
Permalink
Recently, I wanted to upload a file to my friend using sftp. The problem
is that the file had a space in the file name and the standard escape
character of \ didn't seem to work. Is there a way around this? Am I crazy
and doing it wrong? for reference, the line I entered in the sftp prompt is

sftp> put /mnt/pammy/music/Nadasurf-\ Popular.mp3 /files/upload
File "/mnt/pammy/music/Nadasurf-\\" not found.

Thanks

Ross Penner
Daniel
2005-10-20 07:21:39 UTC
Permalink
Post by ross
Recently, I wanted to upload a file to my friend using sftp. The problem
is that the file had a space in the file name and the standard escape
character of \ didn't seem to work. Is there a way around this? Am I crazy
and doing it wrong? for reference, the line I entered in the sftp prompt is
sftp> put /mnt/pammy/music/Nadasurf-\ Popular.mp3 /files/upload
File "/mnt/pammy/music/Nadasurf-\\" not found.
Try enclosing the path+filename fully in single or double quotes.

ie. '/mnt/pammy/music/Nadasurf-\ Popular.mp3' or
"/mnt/pammy/music/Nadasurf-\ Popular.mp3"
ross
2005-10-20 07:34:48 UTC
Permalink
I tried that already and got the error

Bad escaped character ' '
Post by Daniel
Post by ross
Recently, I wanted to upload a file to my friend using sftp. The problem
is that the file had a space in the file name and the standard escape
character of \ didn't seem to work. Is there a way around this? Am I crazy
and doing it wrong? for reference, the line I entered in the sftp prompt is
sftp> put /mnt/pammy/music/Nadasurf-\ Popular.mp3 /files/upload
File "/mnt/pammy/music/Nadasurf-\\" not found.
Try enclosing the path+filename fully in single or double quotes.
ie. '/mnt/pammy/music/Nadasurf-\ Popular.mp3' or
"/mnt/pammy/music/Nadasurf-\ Popular.mp3"
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Daniel
2005-10-20 12:22:14 UTC
Permalink
Post by ross
I tried that already and got the error
Bad escaped character ' '
Can you past everything you entered, exactly as it appears?
ross
2005-10-20 17:01:45 UTC
Permalink
Post by Daniel
Post by ross
I tried that already and got the error
Bad escaped character ' '
Can you past everything you entered, exactly as it appears?
my prompt copy and pasted.

sftp> put "/mnt/pammy/music/Nadasurf-\ Popular.mp3" /files/upload
Bad escaped character ' '
sftp> put '/mnt/pammy/music/Nadasurf-\ Popular.mp3' /files/upload
Bad escaped character ' '
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Will Maier
2005-10-20 17:23:03 UTC
Permalink
Post by ross
my prompt copy and pasted.
sftp> put "/mnt/pammy/music/Nadasurf-\ Popular.mp3" /files/upload
Bad escaped character ' '
sftp> put '/mnt/pammy/music/Nadasurf-\ Popular.mp3' /files/upload
Bad escaped character ' '
If you're putting the filename in quotes, you don't need to escape
the space (hence the 'Bad escape' error).

~ % touch "this is a test"
~ % sftp $SERVER
Connecting to merk...
sftp> put this\ is\ a\ test
File "this\\" not found.
sftp> put "this is a test"
Uploading this is a test to /home/$USER/this is a test
this is a test 100% 0 0.0KB/s 00:00
sftp>
--
o--------------------------{ Will Maier }--------------------------o
| jabber:***@jabber.ccc.de | email:***@ml1.net |
| \***@cae.wisc.edu | \***@cae.wisc.edu |
*------------------[ BSD Unix: Live Free or Die ]------------------*
Loading...