I often use SCP to copy files around – particularly web-related files. The problem is that whenever I do this, I can't get my command to copy hidden files (eg, .htaccess).
I typically invoke this:
scp -rp src/ user@server:dest/
This doesn't copy hidden files. I don't want to have to invoke this again (by doing something like scp -rp src/.* ...
– and that has strange .
and ..
implications anyway.
I didn't see anything in the scp
man page about an "include hidden files".
How can I accomplish this?
Best Answer
That should absolutely match hidden files. The / at the end of the source says "every file under this directory". Nevertheless, testing and research bear you out. This is stupid behavior.
The "answer" is to append a dot to the end of the source:
scp -rp src/. user@server:dest/
The real answer is to use rsync.