help with a bash script
Marianne Taylor
mataylor
Mon May 17 12:00:46 PDT 2004
On March 19, 2004 07:12, Kurt Wall wrote:
> In a 1.3K blaze of typing glory, Brad De Vries wrote:
> > --- Kurt Wall <kwall at kurtwerks.com> wrote:
> > > --- cut---
> > > #!/bin/sh
> > > cd /some/dir
> > > find . -type f -mtime +5 | xargs rm
> > > --- cut ---
> >
> > Is there any reason for not using the -exec parameter
> > of the find command:
> >
> > find . -type f -mtime +5 -exec rm {} \;
>
> It is inefficient. xargs constructs a command line based on the input
> piped to it (up to a built-in limit that you can modify on the command
> line), whereas -exec executes the command for each argument.
>
> Kurt
Thanks Joel and Kurt and anyone else that helped. I knew there was an easier
way than what I had. One question... Is it necessary to specify "." for the
current directory or is that the default behaviour?
Additionally if I run the following line to test this
find . -type f -mtime +15 -exec rm {}\;
I get this error message ...
find: missing argument to `-exec'
More information about the Linux-users
mailing list