Copying Hidden Directories
I am making a backup of my home directory, and when I tried like cp -ar * /home/home-bkup and it didn't copy those directories that start with a . and my question is how do I do that?
Check out this post. Tricky, but it should work :)
So I guess the command you'd want is:
cp -ar * .[^.]* /home/home-bkup
The junk with the brackets just tells cp to also copy anything beginning with a dot, but not beginning with two dots (to prevent it from copying everything in the parent directory also). The same technique can also be used with rm, to remove hidden files, but be careful with it in that case, especially if you are running as root! You could very easily remove a whole bunch of stuff you didn't mean to.
|All times are GMT -5. The time now is 04:54 PM.|