Uploading directories with sftp?
I'm having some trouble uploading directories(which contain other directories a few levels deep) by sftp. I realize I could work around this by gzipping, but I don't see why that's necessary.
Anyway, I try
sftp> put bin/ Uploading bin/ to /home/earlz/blah/bin bin/ is not a regular file sftp> put -r bin/ Uploading bin/ to /home/earlz/blah/bin Couldn't canonicalise: No such file or directory Unable to canonicalise path "/home/earlz/blah/bin"
I think the last error message is completely stupid. So the directory doesn't exist? Why not create the directory?
Is there anyway around this issue with sftp, or should I just use scp?
CORRECTED: I initially claimed wrongly that OpenSSH did not support
put -r. It does, but it does it in a very strange way. It seems to expect the destination directory to already exist, with the same name as the source directory.
sftp> put -r source Uploading source/ to /home/myself/source Couldn't canonicalize: No such file or directory etc. sftp> mkdir source sftp> put -r source Uploading source/ to /home/myself/source Entering source/ source/file1 source/file2
What's especially strange is that this even applies if you give a different name for the destination:
sftp> put -r source dest Uploading source/ to /home/myself/dest Couldn't canonicalize: ... sftp> mkdir dest sftp> put -r source dest Uploading source/ to /home/myself/dest/source Couldn't canonicalize: ... sftp> mkdir dest/source sftp> put -r source dest Uploading source/ to /home/myself/dest/source Entering source/ source/file1 source/file2
For a better-implemented recursive
put, you could use the PuTTY
psftpcommand line tool instead. It's in the
putty-toolspackage under Debian (and most likely Ubuntu).
Alternately, Filezilla will do what you want, if you want to use a GUI.