On Mon Apr 17, 2006 at 09:08:06 +1000, Charles Myers wrote:
>Guys, I have searched google etc but failed to find an answer to this
>(im pretty sure though I have seen somewhere that it can be done...)
>
>
>I have a heap of photos (sorted by iPhoto) and it does it in multiple
>directories of year, month,date etc..... I have moved the whole photo
>tree over to my desktop (which runs ubuntu). I was hoping to move all
>the .jpg's into a single directory if this is possible.. 
>
>I have tried mv /photos/*.jpg /newphotos -r  but of course this dont
>work :( Would anyone have any suggestions how to do what I wanted to do?
>
>
>Thanks for any help you can provide...

If you are using zsh, it has a neat feature where you can glob down multiple
directories. E.g:

mv /photos/**/*.jpg /newphotos

Will match all .jpg files under photos. But you will end up with all those jpgs
in the one directory which is probably not what you want. Another problem is 
that
you can only have so many arguments on the command line, and if your photo 
collection
is large that won't work.

So assuming you have lots of photos and you have:

/photos/2006/5/3/foo.jpg and you want to have: newphotos/2006/5/3/foo.jpg etc,

I'd probably do something like:

cp -R photos newphotos                     # Copy all the photos
find ./photos -name "*.jpg" | xargs rm     # find all the .jpg in photos and 
remove them
# find all regular files that aren't .jpg in newphotos and remove them
find ./newphotos \! -name "*.jpg" -type f | xargs rm  

If doing the copy was bad for some reason (e.g: you don't have enough
space for two copies), I'd be writing a script of some form to do the 
work.

HTH,

Benno
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to