Use Terminal To Move Photo Library Mac

The command line—that hidden world of code behind your Mac’s pretty face—sometimes offers a quicker way to do everyday tasks, plus it’s just a cool way to establish your tech cred. You’ve learned how to navigate files and folders as well as delete files and folders with the command line and get help when you need it from man pages. Here, I’ll show you how to copy and move files, common operations that often come in handy. I’ll also show you how to create directories (that’s Unix-speak for folders), so you can move files to new places.

Why bother with the command line?

Mac Os Photo Library

It’s certainly easy to copy and move files in the Finder, but there are a number of reasons why you might want to do this from the command line instead:

In the Terminal app on your Mac, use the mvcommand to move files or folders from one location to another on the same computer. The mvcommand moves the file or folder from its old location and puts it in the new location. For example, to move a file from your Downloads folder to a Work folder in your Documents folder. Assuming you use Photos or iPhoto as your Mac image library app, then the library may hold the only copy of every photo you've taken with a digital camera or your smartphone. Your image library should probably have its own dedicated backup method in addition to Time Machine to ensure that one-of-a-kind photos are retained for the long term. Download photos from iPhone to Mac using iCloud Photos; Transfer photos from iPhone to Mac using AirDrop; Method 1: Download Images Using iCloud Photos. Best For: Automatic wireless transfer of all photos from your iPhone. ICloud Photos offers a simple way to transfer your entire photo library from iPhone to Mac. It doesn’t involve any cables. Wish you could move a bunch of folders all at once or instantly move every file of a certain type into a new folder? Using your Mac's Terminal commands may be the answer. To transfer your photos library from an Apple Mac to an external drive, you first need to locate the photos or a folder you wish to move. You can right-click and copy, then paste in the new location. Dragging and dropping will also copy the images or folder.

  • You can copy or move files from one location to another without opening windows in the Finder.
  • You can copy or move files that are hidden in the Finder. These files, which can contain settings for certain apps or parts of the Mac, contain a dot (.) before their names, and the Finder doesn’t show them.
  • You can copy or move multiple files using wildcards.
  • You can rename a file quickly.
  • If you’ve lost access to the Finder because your Mac is on the blink, you might be able to use the command line to troubleshoot the problem.

The difference between copying and moving files

If you’re in the Finder, and you drag a file from, say, your Desktop to your Documents folder, or any other folder on the same disk or volume, you move the file. The file is no longer on the Desktop, and is found only in the Documents folder. However, if you drag a file from your Desktop to an external hard disk, you’ll see that the file remains in its original location; this file has been copied. (You may know that you can copy a file in the Finder, even on the same hard disk, by holding down the Option key when you drag it.)

The same is the case from the command line. There are two commands for moving and copying: mv and cp. The first does the same as dragging a file to a new location on the same hard disk; the second does what an Option-drag does, or what happens when you drag a file to a different disk or volume.

How to copy files

Copying files with the cp command is simple. First, launch Terminal (in your /Applications/Utilities folder). Then, use the following syntax to create your command:

cp source destination

For example, to copy a file named MyFile.rtf from your Desktop folder to your Documents folder, you would type in the following command in Terminal and then press Return:

Apple photo library

cp ~/Desktop/MyFile.rtf ~/Documents

You’ll now have a file named MyFile.rtf on your Desktop, and a copy of that file in your Documents folder.

You’ll remember from “Master the command line: Navigating files and folders” that the tilde (~) symbol is a shortcut for your Home folder, which contains your Documents folder. This command takes the file at the precise path you specify as the source argument, and moves it to the directory (folder), which is the destination. Note that if there’s no file there, or if you type the name incorrectly, Terminal will give you a “No such file or directory” error.

You can also copy directories, including all the files they contain. This uses a special “flag” or “option” with the cp command: the -R or recursive flag. When you use options with commands, this additional letter—always preceded by a hyphen (-)—tells the command to do something a bit differently. The recursive option tells the cp command to copy every item in the folder: every sub-folder, every file and folder in every sub-folder, and so one, all the way down, to the new location. So you can copy a directory from your Desktop to your Documents folder like this:

cp -R ~/Desktop/MyFolder /Documents

How to move files

You’ve probably guessed that the mv command works in the same way. But there are two ways you can use the mv command. The first moves a file to a different disk or volume; remember, just as in the Finder, copying a file to a different volume won’t delete the original, whereas moving will. So you could issue this command to move a file from your Desktop to a folder on a backup disk:

Photo

You can also move directories with the mv command. The syntax is the same, and you don’t need the -R flag as you do with the cp command.:

Change photos library macUse Terminal To Move Photo Library Mac

mv ~/Desktop/MyFolder /Volumes/Backup

How to copy or move multiple files

One of the great things about the command line is the way you can use wildcards to simplify commands. For example, if you want to copy all the .rtf files (Rich Text Files) from your Desktop to your Documents folder, you can use the asterisk (*) wildcard:

cp ~/Desktop/*.rtf ~/Documents

Export mac photos library

You can use the same wildcard with the mv command to move multiple files.

How to rename files

The mv command also lets you quickly rename files. What you do is essentially move a file to the same location, but change its name. If you specify a name for its destination, the mv command changes the file’s name when it moves the file. You can change a file name like this:

mv ~/Desktop/MyFile.rtf ~/Desktop/MyFile-old.rtf

This is a valuable tool for troubleshooting; you can use this to create a backup copy of a file, such as a preference file, in case you need it again. But you can also use this renaming method simply because you want to rename a file.

You can also copy a file with cp and change its name. In this case, you need to specify not just a destination directory, but also a name for the file:

cp ~/Desktop/MyFile.rtf ~/Documents/MyFile1.rtf

How to create directories (a.k.a. folders)

Here’s one final command that may come in handy: mkdir, the make directory command. This is very useful when you need to make a bunch of folders in one fell swoop, say for a new project you’re starting. First use the cd (change directories) command to move into the directory where want to create a new directory. Once you’re there, run this command:

mkdir MyDirectory

You can use any name for the directory (for instance, “Hot Project” or “TPS Reports”), and you can make multiple directories with a single command:

mkdir MyDirectory1 MyDirectory2 MyDirectory3

With these three simple commands—mv, cp, and mkdir—you’ll be able to copy and move files, as well as create directories to hold files anywhere in your Mac’s file system. As you become proficient with these commands, you’ll see how easy they are to use.

Mac Photo Library Files

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read ouraffiliate link policyfor more details.

    Related:
Senior contributor Kirk McElhearn (@mcelhearn) writes about Macs, music and more on his blog Kirkville. He also runs Kirk's iTunes Forum, where users can discuss iTunes, iOS devices, music, and more. Kirk is the author of Take Control of iTunes 12: The FAQ.