I would like to make a "hard-links" copy of my home directory before syncing my home directory with another computer with unison, just in case unison goes awry.
But cp -al
tries to link to all files, including hidden . files, which results in many errors. I am not trying to sync . hidden files or any "system" files, just my own data.
Is there any way to make cp -al ignore . hidden files? Or another command that has cp -al
functionality that can be made to ignore . hidden files?
It is usually enough to skip hidden files and hidden directories at the first level in the home directory, and then the following command should work,
The wild card,
*
, will not select hidden files and hidden directories for copying. The optionv
will show which files are copied (useful while testing).Please remember that hard links work only within the same partition and only for files. You need symbolic links across partitions and for directories.
So
cp
copies the directories to new inodes and hardlinks the files to the same inode as the corresponding source file.