How can I upload an entire folder, that contains other folders, using sftp on linux?

Chris picture Chris · Apr 10, 2012 · Viewed 89.9k times · Source

I have tried put -r directory/*, which only uploaded the files and not folders. Gave me the error, cannot Couldn't canonicalise.

Any help would be greatly appreciated.

Answer

Ben Thielker picture Ben Thielker · Jan 10, 2014

For people actually wanting a direct answer to this question (instead of being told to use something other than sftp)...

put -r local/path/to/directoryName

The uploaded directory must already exist in the working directory on the server, so you might need to create it first.

mkdir directoryName