Re: How to execute more than one command with find -exec?

From: IANAL_VISTA (IANAL_Vista_at_hotmail.com)
Date: 11/18/04


Date: Thu, 18 Nov 2004 15:03:55 GMT

Cheng Mo <mo.cheng@nospam.nospam> wrote in
news:cnhpnt$rue$1@avnika.corp.mot.com:

> The scenario is:
> In folder XXX there are lots of *.gif files. Those *.gif files whose
> filename don't appear in file abc.txt should be deleted. I want to do
> this job in one line command.
> find XXX -name "*.gif" -exec ........... \;
> But I don't know how to write the part of ..............
>
> I tried
> find XXX -name "*.gif" -exec grep {} abc.txt || rm {} \;
> But it seems -exec don't take behind as a combination of two commands.
> Anybody can tell me how to execute more than one command with find -exec?
> Thanks
>

Try creating a script that contains everything you want to do.

P.S.
I know all about using "|" as the pipe operator.
What does "||" (double pipe) supposed to do?



Relevant Pages