Running a command on all file occurences in a directory tree

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Tue Oct 12 16:34:37 UTC 2004


On Fri, Oct 08, 2004 at 05:53:49PM -0400, 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.

Assuming concert allows you to reuse the same filename without any
problems (most programs do not) then somtehing like this should work:

find . -name \*.jpg -exec convert "{}" -resize 425 "{}" \;

Lennart Sorensen
--
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