May 21

The command ditto is a unix based command that can be used in Terminal on OS X.  Ditto is useful if you have a hard drive that is failing or if you need to transfer data from one directory to another.  There are other commands that can perform this same function, but I find ditto a much better option as it preserves resource forks in each directory and file.  The command will grab any files in a specified directory and copy them.  If the hard drive is failing or the file is corrupted, Terminal will skip over them and move on.  Compare this to the normal method of copying.  If a portion of the drive is failing and you attempt to copy a directory, the copy will fail, and almost no data will be transferred.

The command itself is rather easy to remember:  ditto src_directory dest_directory. src_directory and dest_directory can be manually typed in or the actual folder you want to copy can be dragged onto the terminal window; Terminal will do a lot of work for you if you let it.  My preference when using ditto is to use the -V option, which outputs all files and folders copied to the new location.  Without using an option, or modifier, there will not be an output or visual indicator that files are being copied.

For instance, if I wanted to copy another user folder from my internal hard drive to my external hard drive, the command would look something like this:

sudo ditto -V /Users/bobthebuilder /Volumes/BackupDrive/bobthebuilder

The sudo command is necessary when you do not have proper permissions to access or copy data from a specific directory.  Sudo requires an administrator password and basically tells Terminal to: “Do it, and don’t ask any questions”, so be careful!

A great resource to find more information about ditto or any other command, open terminal, and type man (short for manual) and then the command: man ditto

If you have questions, feel free to leave them as comments or email me.

7 Responses to “Terminal: Ditto Command”

  1. KattyBlackyard Says:

    Hi, gr8 post thanks for posting. Information is useful!

  2. ElenaLisvato Says:

    Hi, I can’t understand how to add your site in my rss reader. Can you Help me, please :)

  3. Zashkaser Says:

    Excellent review! Mint takes Ubuntu and makes it work! After your review, I plan to use it.

  4. LenaShopogolik Says:

    Excellent review! Mint takes Ubuntu and makes it work! After your review, I plan to use it.

  5. Sdanektir Says:

    Just wanted to say HI. I found your blog a few days ago on Technorati and have been reading it over the past few days.

  6. Vivalkakira Says:

    Hi, good post. I have been woondering about this issue,so thanks for posting. I’ll definitely be coming back to your site.

  7. VitalikGromovss Says:

    Hi, cool post. I have been wondering about this topic,so thanks for posting. I’ll likely be coming back to your site. Keep up the good posts

Leave a Reply