Copy files using the Terminal instead of the Finder Mac OS X

Copy files using the Terminal instead of the Finder Mac OS X

First ensure that you have both the source files and your copy destination mounted and available on your system so you can see them in the Finder. Then open the OS X Terminal and perform the following steps:

  1. Enter your copy command and options.
    There are many commands that can copy files, but the three most common ones are “cp” (copy), “rsync” (remote sync), and “ditto.” As with any terminal command, each of these is a separate program that can take optional flags to tailor its behaviors for your needs, such as allowing it to preserve permissions on the copied files, or allow it to copy recursively into directories, and so on. These options can be looked up in the manual pages for each program, which can be done by typing “man cp” or “man ditto” in a Terminal window (or doing a Google search), but for most purposes the following options should be adequate:

    cp -av
    
    rsync -av
    
    ditto -v
  2. Specify your source files
    With one of the above commands and flags typed, continue by typing a single space and then drag the parent folder of your source files to the Terminal window. When you do this the full path to the folder will be input at the cursor along with a single space. Remove this space by pressing the delete key once, and then type “/*” to tell the command to specify all items within the parent folder (otherwise the parent folder itself will be the target). At this point the command should look similar to the following:

    rsync -av /path/to/source/*
  3. Specify your destination folder
    After you have entered the slash and asterisk characters, enter a space and then locate the folder where you would like to copy the files and drag it to the Terminal window. As with the source folder this should enter the full path to the destination folder. This time instead of adding a slash and an asterisk to the end, only add a single slash so the command looks like the following:

    rsync -av /path/to/source/* /path/to/destination/

This command now tells the computer to run the “rsync” command (or other copy command you’ve chosen), and use the “a” and “v” options for this command (in this case they are for “archiving” and “verbose” mode to ensure all files are copied as-is and list them as they are being copied). It then tells the system to target all files within the source directory and put them within the destination directory. At this point, pressing Enter will run the command, and copy the files.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top