I am migrating my home directory from an old system to a new one, and the tarball I made contains everything, including hidden files like .bashrc. However, when I move the contents of the unpacked tarball (which are in /tmp) to my new home directory, the hidden files do not copy (
mv /tmp/home/rcook/* /home/rcook/). How can I get mv to move them?
Actually, I think the problem is not with mv, but with bash's globbing. If I do this:
mkdir a mkdir b touch a/.foo touch a/bar mv a/* b/ ls -a a/ b/
I see this:
a/: . .. .foo b/: . .. bar
a/.foo did not move. So how can I get the * wildcard to find hidden files?
Yes, I suppose I could decompress the tarball directly into my home directory, but the tarball decompresses into
home/rcook/..., and I want to be sure I overwrite the new
.bashrc, etc. with the old, customized versions, and knowing how to find and move hidden files is a worthwhile skill. Suggestions?
Some answers suggest doing something like
mv src/.* dest/. However, I tried this on my test directories and got errors. Starting with:
rcook$ ls -a a/ b/ a/: . .. bar .foo b/: . .. rcook$ mv a/.* b/ mv: cannot move 'a/.' to 'b/.': Device or resource busy mv: cannot remove 'a/..': Is a directory rcook$ ls -a a/ b/ a/: . .. bar b/: . .. .foo
What am I doing wrong?