Mac Unix Tip

If you have a Mac and you’ve used the Terminal application to run Unix scripts, here is a useful tip for you. Everyone has used the cp command to copy files from one path location to another. However, many files in the Mac have so called resource forksassociated with the files that do not get copied along when using the cp command. Briefly, ditto is an Apple-developed tool for copying entire directories. Most important, ditto has a -rsrc option flag that ensures resource forks as well as creator/type codes are preserved in the copies. For example, this command will copy the Office X Identities directory from my home directory to the Backup directory on the external drive “Secondary”:

ditto -V -rsrc ~/Documents/”Microsoft User Data/Office X Identities” “/Volumes/Secondary/Backups/Office X Identities”
The above command is all one line.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.