Comment by imp0cat

7 hours ago

Yes, but try rsync instead of scp. Mind the slash though!

Both rsync -avz /path/to/file user@server:/another/path/to/ or rsync -avz /path/to/file/ user@server:/another/path/to/file

Will create directory named /another/path/to/file which will contain all contents of the original directory (/path/to/file/*).

Basically, if you include the trailing slash in the source path, only contents of the directory will be copied (useful when you need to rename it).

    rsync -avz path/to/old_dir/ user@server:/path/to/new_dir

If you omit the trailing slash in the source path, rsync will create the target directory for you. See man rsync for more info.