 |
 |
Help with Terminal
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2003
Status:
Offline
|
|
I hope this is the right place for this question, but I need help with using Terminal on Leopard, latest version.
I need to move all files within a directory and its sub-directories into another directory, but without the sub-directories. Can someone please help me with the Terminal command to do this?
For example:
/Photos
/Photos/01 (50 jpgs)
/Photos/02 (75 jpgs)
/Photos/03 (50 jpgs)
/Photos/04 (50 jpgs)
Move into:
/New Photos (all 225 jpgs)
Thanks!
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
I'm moving this to Applications, but you can do
mv Photos/*/* New\ Photos
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
parallax is right, but just FYI, you don't need help with Terminal. Terminal is a very simple application. What you need help with is the Unix environment accessible via the terminal.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jul 2006
Status:
Offline
|
|
Why do you need to use the Terminal to do that? Why not just open two Finder windows, one at New Photos, the other at 01, select all (Cmd-A), drag and drop into New Photos, repeat process with 02 to 04?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
Curiosity: because using the Finder involves several more steps?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status:
Offline
|
|
Originally Posted by besson3c
Curiosity: because using the Finder involves several more steps?
More steps than posting the questions in a forum ?
-t
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Originally Posted by Curiosity
Why do you need to use the Terminal to do that? Why not just open two Finder windows, one at New Photos, the other at 01, select all (Cmd-A), drag and drop into New Photos, repeat process with 02 to 04?
I can't speak for Miykael, but it's entirely possible that we're actually talking about thousands of files in hundreds of folders. Rearranging a whole file tree by hand can be pretty tedious. I'd turn to the Terminal too.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2003
Status:
Offline
|
|
Chuckit is bang on. I have thousands of photos in hundreds of directories that need to be moved to a single directory to run an exif program on. I haven't tried parallax's command yet, but will do that today.
Much thanks everyone! If it works, it will save my tons of time.
Plus, for Curiousity sake, I'd rather learn now so I can use it again later! =)
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status:
Offline
|
|
Originally Posted by miykael
Chuckit is bang on. I have thousands of photos in hundreds of directories that need to be moved to a single directory to run an exif program on. I haven't tried parallax's command yet, but will do that today.
Much thanks everyone! If it works, it will save my tons of time.
Plus, for Curiousity sake, I'd rather learn now so I can use it again later! =)
You DO know that there is NO undo for Terminal commands.
You better be sure of what you are doing.
-t
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2003
Status:
Offline
|
|
I didn't know that, but I'll back up everything first. They are my photos, and so I do backup regularly. Thanks for the tidbit. I am getting to love using the Terminal... just need more time and experience with it.
MacNN rocks.
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
Warning: composed in Safari, not tested. Run at your own risk. Back up first.
find /Photos -iname \*.jpg -exec mv {} /New\ Photos/ \;
edit: just tested it, and it seems to work. You should still back up first though.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
Originally Posted by CharlesS
Warning: composed in Safari, not tested. Run at your own risk. Back up first.
find /Photos -iname \*.jpg -exec mv {} /New\ Photos/ \;
edit: just tested it, and it seems to work. You should still back up first though.
find /path/to/Photos -type f -exec cp {} /path/to/New\ Photos/ \;
should also work with non jpg photos too (you can also substitute "mv" for "cp" if you'd prefer to move rather than copy)
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
That one will also pick up useless crap like the .DS_Store files, though. Mine should be good enough, since he mentioned that the pictures were jpgs. The cp command instead of mv might be safer, though, although if you back up first like I told you to, that won't be an issue.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Online
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
If you don't use the Terminal much, it's worth explaining a little bit:
CharlesS's command assumes that there is a folder at the root level of your main hard drive called "Photos", and it will move all files named <something>.jpg to another folder at the root level of your main hard drive called "New Photos".
Parallax's command will look for a folder called "Photos" in the directory you're currently in (in the Terminal), look for all that folder's subfolders, and move the contents of all those subfolders into another folder called "New Photos", also in the directory you're currently in.
Hopefully that wasn't too confusing, but there are some subtle differences there.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Offline
|
|
Originally Posted by Chuckit
CharlesS's command assumes that there is a folder at the root level of your main hard drive called "Photos", and it will move all files named <something>.jpg to another folder at the root level of your main hard drive called "New Photos".
Yeah, I was just going with the example directories the OP provided, /Photos and /New Photos. You'd want to replace those with the paths to the actual folders on your machine, of course.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|