Hey Sean. What’s a good command line to copy everything over from Drive A to Drive B?


Great question, this is one of those really useful commands that you can learn easily and it works way better than its counterpart drag and drop functionality in the Finder on macOS, so it's a terrific example of the command line doing something better, or at least with more flexibility, accuracy and visibility than is possible in the graphic user interface.

Here's what you do, I'm including # comments in-line to go way over board with describing what each part of the command actually does. This assumes a novice level of knowledge going in.

Open Terminal on your macOS system.

#Type the following, and when prompted enter your password. This assumes you are an admin user.

sudo -s


# Then type the following replacing the examples below with your actual file paths. (pro tip, in macOS you

# can drag and drop the source directory and destination directories from Finder into Terminal and the

# paths will type out for you.

cp -Rpv /Volumes/Source/ /Volumes/Destination/


# cp is the copy command included as a tool available to you at the command line in Terminal.app

# anything that is preceded by a - is a flag that modifies the way CP will work right now.

# -R means copy everything I say, and everything inside of it Recursively. Must be a capital R.

# -p means preserve permissions, modification times, and all other metadata.

# -v means do it all verbosely so I can see the result of every file copied.

# of note:


# Starting for example with a folder called source and another called destination as seen here.

# the source directory path needs to have a trailing slash on it so the contents of the directory (Folder, or Volume)

# are copied into the target, rather than the enclosing source directory (Folder or Volume) itself.

#Without a trailing slash on the source path, you will get the folder called source inside of destination.

# Which creates a second layer you don't want.

# With a trailing slash on the source path, you will get the folder contents of source inside of destination,

# which is almost always what you do want.