using Terminal to copy files from external usb drive to another external hdd

New to using Terminal so be gentle. I keep my lightroom catalog on a little external thumbdrive on my macair. Now the thumbdrive does not appear in the Finder but it is present in Disk Utility and in Terminal. So I want to copy my lightroom catalog as well as the few photos saved to this thumbdrive to another external hd so I can attempt to reformat this drive, which may solve the Finder issue.


My question is, I am very new to Terminal and all I know is that I want to COPY the files not MOVE the files. I don't know how to properly write the command lines to tell Terminal where my Directories are and where I want to send them (so i don't know how to indicate paths) and i don't know the proper Terminal to execute a Copy Directory.


Thanks!

MacBook Air, iOS 10.1.1

Posted on Jan 5, 2017 4:10 AM

Reply
26 replies

Jan 5, 2017 8:16 AM in response to Roger Wilmut1

i got this.... but feel we're getting closer 🙂

Last login: Thu Jan 5 14:04:02 on console

lesMacAir:~ leslielausch$ cp -R /Volumes/LR\ Catalog\ &\ Photos /Volumes/LR\ Catalog\ &\ Photos\ BackUp

[1] 570

[2] 571

-bash: Photos: command not found

-bash: Photos BackUp: command not found

[2]+ Exit 127 \ Photos /Volumes/LR\ Catalog\

lesMacAir:~ leslielausch$ usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file

cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory


[1]+ Exit 64 cp -R /Volumes/LR\ Catalog\

lesMacAir:~ leslielausch$ cp -R /Volumes/LR\ Catalog\ \&\ Photos /Volumes/LR\ Catalog\ \&\ Photos\ BackUp

cp: /Volumes/LR Catalog & Photos: No such file or directory

lesMacAir:~ leslielausch$


SOURCE USB XHD USB

User uploaded file


TARGET XHD USB

User uploaded file

Jan 5, 2017 8:37 AM in response to loosecaboose

I'm teetering on the limits of my knowledge of this sort of thing. Try this to check whether Terminal can actually see the volume and files:


ls Volumes/LR\ Catalog\ \&\ Photos


(that's letter l, not 1). This should list the contents of the directory 'LR Catalog & Photos'. I've tried this with a thumb drive containing various directories and it worked OK (it won't list any directory contents). If you get a 'no such' response Terminal may not be able to see the drive. I found it wouldn't work with a drive which had been unmounted but was still plugged in.


Your screenshots have appeared since I previously looked at your post. Try clicking 'Mount' for the thumb drive.

User uploaded file

Jan 5, 2017 4:59 AM in response to loosecaboose

loosecaboose wrote:


man cp is tmi for someone who only ever used Terminal to disable Apple Photos from launching and I only did that by literally copying and pasting code. Which is what I'm looking for here.

Use another GUI tool to copy the disk, then. If it shows in Disk Utility and is accessible in Terminal, there is no reason short of some setting that is preventing it from showing in the Finder (Go Computer, perhaps).

Carbon Copy Cloner or SuperDuper would likely be able to see it if it is mounted.


Or, use the Restore function in Disk Utility to copy one to the other. Select the empty drive in Disk Utility and click the Restore button. Set the source disk in the popup menu. That will completely replace the contents of the destination drive with the contents of the source drive. The destination would have to be at least as big as the source.


If you only know how to copy and paste "some code," then you will likely end up wiping out your drive instead of copying it. Then, you'd just blame us.

We'd have to know the name of each of the volumes as shown in /Volumes to provide the necessary code for you to copy and paste.

Jan 5, 2017 5:05 AM in response to Barney-15E

Restore in Disk Utility will delete everything on my source drive, so I'm not sure that is a very constructive reply. I'm asking for anyone proficient in Terminal not interested in Finder options because Finder is not working. Please read the question because I literally said I'm interested in utilizing the CP Copy command and not the Move command in Terminal, to prevent erasing the source data.

Jan 5, 2017 5:25 AM in response to loosecaboose

We can start w/ if anyone can walk me through the proper syntax to tell Terminal the path to an external USB drive, that would be a great first step in this process.
So i'm looking for an example of code if my external thumb drive Volume name is: LR Catalog & Photos and it is unmounted. Or do I use the Device Tree Path or the volume name or do i use the drives name and not the partition to indicate where I want Terminal to go...

Jan 5, 2017 5:40 AM in response to loosecaboose

Restore will not erase the Source. It will erase the destination. I'm not sure where you got that idea from.

I gave you one Finder option which will work if the drive is visible in Terminal. The rest are just other GUI options

cp -R source_dir target_directory

Don't put a trailing / on source_dir so it will copy that folder also.

That's the best I can offer since you didn't give the rest of the information.


Now, not knowing anything about a Lightroom catalog structure, there may be other options required in the copy command to pull it over correctly. If the catalog contains hard links, then you can't use copy.

Jan 5, 2017 5:38 AM in response to Barney-15E

Ok this is Awesome!
Are you certain Restore wont wipe the source disk? because then I'll try that option. In another forum I was told it will wipe out the source disk too.
Thing is Finder wont work because the disk is unmounted and wont mount. Maybe I can attempt to mount it via a Terminal command?
My problem with the cp -R source_dir target_directory is that i'm am dumb w/ Terminal so I don't know the name of source dir or my target dir. How do find out what the name of these dir are exactly? Is it the Volume name on the thumb drive?

I'm trying options that wont erase my source drive 100% and figured I'd work my way "up" from Terminal to Disk Utility to Finder...
What info am i missing that I can give you?

Jan 5, 2017 6:36 AM in response to loosecaboose

The paths in Terminal should be


/Volumes/Drive-name/Directory-name


in each case. If there is a space in a name it should be preceded by a backslash - \


If you have more than directory at root level you could presumably just leave that bit off. You mentioned in your first post that you wanted to format the thumb drive - you are aware that this will erase its contents?

Jan 5, 2017 6:43 AM in response to Roger Wilmut1

Once I successfully pull my lrcat off the drive, I'll reformat to make it friendly w/ Finder and then drag and drop lrcat back to it.


To clarify the syntax: My thumbdrive is called: LR Catalog & Photos
so would the line of code be: /volumes/LR\Catalog\&\Photos/*.lrcat




because i get this:

lesMacAir:~ leslielausch$ /volumes/LR\Catalog\&\Phots/*.lrcat

-bash: /volumes/LRCatalog&Phots/*.lrcat: No such file or directory

lesMacAir:~ leslielausch$


Jan 5, 2017 8:10 AM in response to loosecaboose

You left the spaces out.Try


cp -R /Volumes/LR\ Catalog\ &\ Photos /Volumes/LR\ Catalog\ &\ Photos\ BackUp


The backslash tells Terminal not to treat the following character as part of the program, as a space would be. It precedes the space or character, not replaces it.


I don't know whether you also need to escape '&' - that can mean something in some programs. If you still get an issue try


cp -R /Volumes/LR\ Catalog\ \&\ Photos /Volumes/LR\ Catalog\ \&\ Photos\ BackUp

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

using Terminal to copy files from external usb drive to another external hdd

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.