Recursively scp except current directory Recursively scp except current directory unix unix

Recursively scp except current directory


cd dir1scp -r . remote:/newfolder

This avoids giving scp a chance to do anything with the name dir1 on the remote machine. You might also prefer:

(cd dir1; scp -r . remote:/newfolder)

This leaves your shell in its original directory, while working the same (because it launches a sub-shell that does the cd and scp operations).


This means copy the list of files made by the shell expansion dir1/* to the remote location remote:/newfolder

scp -r dir1/* remote:/newfolder


You can use the dot syntax with relative path.

scp -r dir1/. remote:/newfolder

If the remote directory does not exist it is created.