Running a command on all file occurences in a directory tree

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


On Fri, Oct 08, 2004 at 08:25:29PM -0400, William O'Higgins wrote:
> 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?

So the shell doesn't expand *.jpg to whatever jpg files are in your
current working dir before executing the command.

Also be sure you make a backup first, and remeber that just because you
want to replace the file doesn't mean that's what convert does.  Some
programs may open the output before they open the input (not smart
maybe) and would hence delete the input before even reading it causing
the file to be deleted.  Hopefully convert is smarter than that.

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