Is there an easy way to recursively copy all hidden files in a directory to another directory? I would like to back up just all the settings files in a home directory, not the normal files. I tried:
cp -R .* directory
but it recognizes .
and ..
and recursively copies all the non-hidden files too. Is there a way to get cp to ignore .
and ..
?
Best Answer
My favorite to move dirs in general has been:
which tars up the current directory to stdout then pipes it to a subshell that first cd's to the destination directory before untarring stdin. Simple, direct, extensible - consider what happens when you replace the () with an ssh to another machine. Or to answer your question you might do: