Recursively scp except current directory

Viewed 13509

Is there a way to scp all files in a directory recursively to a remote machine and keep their original filenames but don't copy the directory it is in?

dir1/file
dir1/dir2/file2

so the contents of dir1 would be copied only. dir1 would not be created. The dir2 directory would be created with file2 inside though.

I have tried scp -r dir1 remote:/newfolder but it creates dir1 in the /newfolder directory on remote. I don't want it to create that dir1 directory. Just put all the files inside of dir1 into newfolder.

3 Answers
Related