Robocopy (Robust) For Mac OS X – CP Command Terminal

Robocopy (Robust) For Mac OS X – CP Command Terminal

If you are looking for an alternative to Windows Robocopy for Mac OS X, look no further. The copy files (cp) command in Terminal works just like Robocopy. CP will copy files in OS X and preserve their structure and attributes. You can also see in real-time the files being copied using the verbose switch. Let’s got started.

 

1. Open Terminal (Applications -> Utilities -> Terminal)

 

2. In Terminal, type man cp to output all the CP commands. In this guide, we will only be concerned with the following switches below for our file copies from hard drive to hard drive.

-a         Preserves structure and attributes of files but not directory structure
-p         Preserves all attributes including times, flags, file mode, ACLs.
-v         Make CP verbose so it shows files as they are copied.

*If you were copying files into a directory with similar files, we would add the below switches to ensure only new files are copied and are not re-copied.

-n         Do not overwrite existing files -R        Copies source files directories and any symbolic links.





 

3. Let’s start a copy. Type cp –apv SOURCE TARGET and hit return, similar to below.

Here’s an example of copying example.txt from external drive VOL to another external drive called VOL-NEW.

cp –apv /Volumes/VOL/example.txt  /Volumes/VOL-NEW

Mac terminal cp command

 

The copy will begin and you can see in real-time (we used the –v switch for verbose mode) in the Terminal window. Once the copy completes, your Terminal screen will be at normal prompt.

You can monitor the size of folder copies by Right Click -> Get Info.

Mac terminal CP command get info folder size

* Please use the comment form below. Comments are moderated.*



Related Posts

 

Comments 7

Guest - Tim B. on Friday, 21 April 2023 12:27

VERY nice, no frills alternative! THANK YOU, doing it now (from external SSD to my Sinology NAS, hardwired via a 1 Gbit switch) Can't thank you enough!

VERY nice, no frills alternative! THANK YOU, doing it now (from external SSD to my Sinology NAS, hardwired via a 1 Gbit switch) Can't thank you enough!
Guest - Ed on Monday, 14 March 2022 23:17

Not like RoboCopy

Not like RoboCopy
Guest - Shayne O'Neill on Tuesday, 19 November 2019 04:52

cp is a poor substitute for Robocopy. I'd instead recomend using RSync. Rsync will give you proper handling for interupted copies, only copy updated files, deal with deletions and so on. Plus it works over various subtrates to copy files over the internet.

cp is a poor substitute for Robocopy. I'd instead recomend using RSync. Rsync will give you proper handling for interupted copies, only copy updated files, deal with deletions and so on. Plus it works over various subtrates to copy files over the internet.
Guest - Ruud on Saturday, 13 July 2019 04:15

Robocopy has the option to make a mirror so only new files and changed files are copies to the new location. Does CP has an option like this?

Robocopy has the option to make a mirror so only new files and changed files are copies to the new location. Does CP has an option like this?
Guest - cache on Thursday, 29 August 2019 20:35

Robocopy will also delete files off the destination that no longer exist on the source.

Robocopy will also delete files off the destination that no longer exist on the source.
Guest - Russell Orem on Monday, 29 January 2018 12:04

How do I do this with a folder? I've only been able to get it to work with individual files

How do I do this with a folder? I've only been able to get it to work with individual files
Guest - Bas on Friday, 05 July 2019 00:52

use the -R option. if the source ends in a / the contents of the folder will be copied and not the folder as a whole.

use the -R option. if the source ends in a / the contents of the folder will be copied and not the folder as a whole.
Friday, 19 April 2024