Recursively scp except current directory
scp, unix
Solution
cd dir1
scp -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).
Problem
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`.