cp command can't do "dotfiles"
This was a real frustration... To copy "dotfiles" like .bashrc with the "cp -R" command, you'd have to do "cp -R ./.* *", yet it'd try to copy ".." and "." in each directory, which doesn't work right. You could do a -R cp of regular files, then do an ls -a and some basename wizardry to copy "dotfiles" afterwards, but it wouldn't do dot directories (directories that start with dot).
After a while, I figured out I can do:
tar --exclude='.' --exclude='..' -cvf server-bak-2005-03-31.tar /mnt/tmphd/* /mnt/tmphd/.*
Finally, someone told me to do...
cp -R /mnt/tmphd/* /mnt/tmphd/.??* .
Still, I don't get why cp doesn't have a parameter to say "include dotfiles" and a parameter to say "include dotdirectories".
Should cp be modified to include this? If there is some secret hidden way, shouldn't it be better documented?
Last edited by netdemon; 04-01-2005 at 02:11 AM.