On Mon, 2006-04-17 at 09:08 +1000, Charles Myers wrote:
> 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?
There's a whole bunch of different ways to do it, and you just missed a
long discussion on a similar subject. But one way:
find /photos -name "*.jpg" | xargs -I{} mv {} /newphotos
(slightly tested, but you may want to have a backup handy, or use cp
instead of mv to make sure you don't lose anything)
The find command searches the directory tree under /photos and outputs a
list of filenames matching *.jpg . Then those names get piped to xargs,
which runs the mv command given on its commandline, replacing {} with
the input it's given. Have a read of the man pages for find and xargs
for more on what you can do with them. And of course ask again here if
you get stuck. :-)
Have fun,
--
Pete
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html