Running a command on all file occurences in a directory tree
Christopher Browne
cbbrowne-HInyCGIudOg at public.gmane.org
Fri Oct 8 22:07:30 UTC 2004
> 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.
There's a way of doing this inside the find command, but I'd suggest the
following:
for picture in `find . -name *.jpg`; do
convert $picture -resize 425 $filename
done
This makes it easy to extend it to have some meaningful output...
a=1; for picture in `find . -name *.jpg`; do
echo "Processing picture $a - $picture"
convert $picture -resize 425 $filename
((a++)
done
--
(format nil "~S@~S" "cbbrowne" "gmail.com")
http://www.ntlug.org/~cbbrowne/sap.html
Seen in dust on Lucent truck:
"Test dirt - do not remove."
--
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