Wednesday, January 2, 2013

Most Popular Post of 2012 - Copying files using Terminal

This was one of my shortest posts but seems to be the most popular one.  I have become the data recovery specialist amongst my friends and increasing have been given old laptops and desktops in hopes of recovering any old pictures or files off them for my friends. Without further ado, Mac Integration's Top Post of 2012


Recently I had to recover some files from a friend's Windows XP harddrive, this seems to be becoming a trend for me. I was able to mount the drive in Mac OS X 10.7 Lion using my Universal Harddrive adapter from OWC but I wasn't able to copy files from the drive as a group becuase there were frequent errors with individual files. Since I wasn't able to use finders copy I knew there had to be a way to force copy files from one location to another. Essentially I knew I needed to tell the computer to copy all the files it could from the drive and ignore the rest. Lucky Terminal came to the rescue. After a quick consult with another friend, I was reminded of Terminal's functionality in copying files but all skipping file with errors and moving onto the next file to copy.

Here is how to do it

cp -RfXv "[source folder]" [destination directory]/[foldername]/


cp  - is the command forTerminal to copy.

R - is for Recursive, and will force the copy command to not only hit folders, but all items within, including subfolders.
f - forces Terminal to copy everything without stopping.
X - tells Terminal to overwrite existing files.
v - puts the command into verbose mode, this way you'll see a scrolling list of what is actually happening as it works
Once you hit return, you should start seeing a list of files start scrolling across your screen!