Categories
User Help

scp the current dir `.` to another name?

This is an edge use case, but can’t find a solution.

I want to copy the current directory ., without necessarily knowing or caring for its name, to a new directory. Using scp.

Bash does not seem to have a problem. e.g. cp -r . ../new-name will generate a new dir copy without any problems. But with scp -r . host:new-name i get scp: error: unexpected filename: .

The workarounds i’m using is to use rsync instead of scp, or to use scp -r ../current-name instead of scp -r .. But would be nice to understand why the obvious way do not work with scp and if there’s a simpler ‘fix’. Also note that i do no want to scp the contents of the current dir to another already-existing dir as in scp -r ./* host:existing-dir/, the goal is to copy the current dir itself to a new location (i.e. create a new dir)

Leave a Reply

Your email address will not be published. Required fields are marked *