ditto

September 22, 2014 | By More

Another commandline gem is ditto (man ditto).

This command, called “ditto,” not only copies the files from the source directory to the destination directory, but creating the destination directory if it doesn’t already exist. It will also merge the contents of the source directory with the destination directory if it exists.

It will follow symbolic links and hard links when copying files and will also preserver permisions and metadata. Which comes in really handy if you are working on say the ‘User Template’ folder for example.

Runing ditto is a snap…

ditto ~/Documents/MyFolder ~/Desktop/MyNewFolder

That would copy MyFolder to the Desktop creating the MyNewFolder if it didn’t already exist.

If you would like to see the verbose output the simply add ‘-V’ before the source folder.

ditto -V ~/Documents/MyFolder ~/Desktop/MyNewFolder

If you need more info on other options again type man ditto.

Category: OS X, Terminal

About the Author ()

Comments are closed.