+2 votes
in Operating Systems by (15.2k points)

I want to upload a folder that has subfolders and several files to a server. I tried put -r directory/*, but it did not work and did not upload subdirectories recursively. How can I upload recursively using put command?

1 Answer

+1 vote
by (25.6k points)

Here are the steps to recursively upload all subdirectories/subfolder and files from a folder to a server:

1. SFTP to the server.

sftp -oPort=xxx username@IP

2. If the name of your directory that you want to upload is 'ABC', create a directory 'ABC' on the server. 

sftp> mkdir ABC

3. Then type 'put -r ABC' to transfer all subfolders and files of the directory.

sftp> put -r ABC

...