Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > a good sucktion script

a good sucktion script
Thread Tools
pisosse
Fresh-Faced Recruit
Join Date: Sep 2003
Status: Offline
Reply With Quote
Nov 23, 2004, 04:42 AM
 
I'll like to suck all of my jpgs from a imported iphoto library with multible folders to one clean folder. I tried to navigate to my iphoto lib folder and type this in terminal :

cp *.jpg -r /dokuments

That somehow didn't work.

BTW..

Could you recormend a good way to organise 3 home computers iphoto libs that would like to be recentble synced?

sorry 2 ifferent quistions but you shell guuys a clever than most...
     
VEGAN
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Nov 23, 2004, 01:44 PM
 
Originally posted by pisosse:
I'll like to suck all of my jpgs from a imported iphoto library with multible folders to one clean folder. I tried to navigate to my iphoto lib folder and type this in terminal :

cp *.jpg -r /dokuments

That somehow didn't work.

BTW..

Could you recormend a good way to organise 3 home computers iphoto libs that would like to be recentble synced?

sorry 2 ifferent quistions but you shell guuys a clever than most...
You should use `foreach'
This should work, I hope I don't make mistakes, so...


foreach i (`ls *.jpg`)
cp "$i" "~/Documents/$i"
end


That should do it.
The spaces my be tricky though. Test it and let me know.
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 23, 2004, 02:54 PM
 
Originally posted by VEGAN:
You should use `foreach'
This should work, I hope I don't make mistakes, so...
um. perhaps i'm missing the obvious, but what's wrong with using "cp -r *.jpg /destination"?

seems to me pisosse had it right the first time, except for the position of the "-r"...
     
Turias
Mac Elite
Join Date: Nov 2003
Location: Minnesota
Status: Offline
Reply With Quote
Nov 23, 2004, 03:07 PM
 
Originally posted by rkt:
um. perhaps i'm missing the obvious, but what's wrong with using "cp -r *.jpg /destination"?

seems to me pisosse had it right the first time, except for the position of the "-r"...
You are telling it to recurse on *.jpg when you want to tell it to recursively find all .jpg files in the folders. Basically, it thinks it should do the command on everything in the current folder named *.jpg, and then to do it on everything under any folders named *.jpg.
     
pisosse  (op)
Fresh-Faced Recruit
Join Date: Sep 2003
Status: Offline
Reply With Quote
Nov 23, 2004, 05:27 PM
 
hmmm thanks guys i'll try them out
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 24, 2004, 03:16 PM
 
Originally posted by Turias:
Basically, it thinks it should do the command on everything in the current folder named *.jpg, and then to do it on everything under any folders named *.jpg.
yeah... umm... isn't that what he wants to do? to find all .jpg files, and copy them into a single place?
     
Turias
Mac Elite
Join Date: Nov 2003
Location: Minnesota
Status: Offline
Reply With Quote
Nov 24, 2004, 03:41 PM
 
Originally posted by rkt:
yeah... umm... isn't that what he wants to do? to find all .jpg files, and copy them into a single place?
Hmm... My wording was confusing. Let me try again.



Running 'cp -r *.jpg dest/' tells your shell to do the following:

1) foreach item in current directory that matches *.jpg, copy that file to dest/

2) now recurse through any directories that match *.jpg, and repeat.

Note how this doesn't actually recurse at all, unless you happen do have a directory called something.jpg in your current location.
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 30, 2004, 11:37 AM
 
Originally posted by Turias:
Hmm... My wording was confusing. Let me try again.
true, true. you're right, i blipped on this one...

by way of penance, i offer:

find ~/Source -name "*.jpg" -exec cp {} ~/Destination \;
     
mrchin
Grizzled Veteran
Join Date: Sep 2000
Location: New Jersey, USA
Status: Offline
Reply With Quote
Dec 2, 2004, 10:22 AM
 
Or you could just open a finder window, with the pictures folder selected in column view. Then just input .jpg into the search selection dialog.

Once they're found, select all and option drag them into your empty folder....

Though, I'd like to know the shell command for it as well. So any new knowledge for me in that aspect is a plus.
Dual 2.0 G5/2.5GB/ATI 9800 Pro | MacBook Pro 2.16 Gore Duo/2GB/ATI X1600
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:39 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,