[sf-lug] question about cp -al

Alex Kleider akleider at sonic.net
Sun Sep 18 16:31:19 PDT 2016


I'm curious as to what exactly the cp -al command does with regard to 
directories.
Rather than make another copy of each regular file, which it would do if 
not for the -l option, hard links are created instead.  What puzzles me 
is how are directories 'copied?'  I assume that they are copied in the 
same way that would happen without the -l option.  Is that correct?

In other words: could the cp -al command be replaced by a routine that 
follows the source directory structure and with in a destination 
directory creates (mkdir) directories and populates them using the ln 
command?  Would the result be the same?

Alex
ps by way of explanation: I've written a little script for doing 
backups- it relies on the cp -la command but the -l option is not 
available on the MacOS so my goal is to create a "work around."




More information about the sf-lug mailing list