Running a command on all file occurences in a directory tree

William O'Higgins william.ohiggins-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Sat Oct 9 00:25:29 UTC 2004


On Fri, Oct 08, 2004 at 07:13:48PM -0400, Fraser Campbell wrote:
>On Friday 08 October 2004 18:48, Chris F.A. Johnson wrote:
>
>> ? ? ? So long as there are no filenames containing newlines:
>>
>> find . -type f -name "*,jpg" |
>> ? while IFS= read -r FILENAME
>> ? do
>> ? ? ?convert "$FILENAME" -resize 425 "$FILENAME"
>> ? done
>
>Why not just:
>
>    find . -type f -name \*.jpg | while read file; do
>        convert "$file" -resize 425 "small-$file"
>    done
>
>
>Also I'd think input and output files should be different on the conver 
>command, though I'm not sure what op wanted.

Thanks for all of the help so far.  I have control over the files in
question, and they are all named in a sane manner.  I am looking to
overwrite the files with their smaller counterparts, so replacing
$FILENAME with $FILENAME is appropriate in this case, but thanks for
checking.

Why would you escape the asterisk in the find command, by the way?
-- 

yours,

William

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gtalug.org/pipermail/legacy/attachments/20041008/f0d18851/attachment.sig>


More information about the Legacy mailing list