Running a command on all file occurences in a directory tree

John Wildberger wildberger-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org
Fri Oct 8 22:22:00 UTC 2004


On Friday 08 October 2004 05:53 pm, William O'Higgins wrote:
> What I want to do is resize all of the JPGs in a long and ramified
> directory tree.  I figured something like:
>
> find . -name *.jpg
>
> in the top of the tree would do the trick for hitting all of the jpgs,
> but I don't know how to take the output of the above and have it do
> this:
>
> convert $FILENAME -resize 425 $FILENAME
>
> Basically, I don't know bash very well and need help with the syntax.
> Thanks.
Try this:
# /bin/bash
for file in *.jpg
do
convert $file -resize 425 $file
done

John
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list