Mac: Copy files intelligently with ditto
dittois slightly more advanced but can be advantageous to ‘cp’ for several reasons, as it not only preserves ownership attributes and permissions but also file resource forks and file and folder metadata, essentially insuring that the file and/or folders are copied exactly. Additionally,dittocan be used to copy a file or folder to a source directory, but if that source doesn’t yet exist,dittowill automatically create it. Also, if the destination folder does exist, the copied contents will be merged together in that destination directory. Finally,dittoalso follows symbolic links, making it particularly handy if you’re a heavy user of thelncommand.
ditto source destination
dittowill check to see if the destination already exists, and if it does, it will merge the directories of the source to the destination:
ditto ~/Pictures/Fall2015/ /Volumes/PhotoBackup/2015/
If for some reason you don’t want to copy metadata and resource forks, use the
–norsrcflag.
Via osxdaily.com.
Leave a comment