Copying symbolic links as regular files

Posted by Wim on July 12, 2015

By default, symbolic links (symlinks) are copyied as they are: pointers. If you want to copy files from a symlink based repository (like GIT Annex), you need to follow the pointer.


If you want to copy the destination file of the symlink (follow the symlink), you need to add the argument -L.

For example:

cp -L /mnt/data/archive/Documents /mnt/backup

This is necessary when copying files from a git-annex repository, which uses symlinks to an internal filestore.

A good explanation between hard and soft links on linux can be found here: Copy symbolic links