Searching for specific files then delete them
Dennis Kaarsemaker
dennis at kaarsemaker.net
Tue Aug 29 20:30:03 UTC 2006
On di, 2006-08-29 at 14:24 +0100, Tony Arnold wrote:
> > find . -name *~ | xargs rm
>
> or
>
> find . -name *~ -exec rm {} \;
>
> The rm command gets executed for each file found and the {} is
> substituted with the file name. The \; is necessary syntax to
> terminate
> the -exec option.
That's not an 'or', that's the correct way.
The suggestion from Dieter will fail on filenames containing e.g.
spaces.
find . -name *~ -print0 | xargs -0 rm
works better, but find's -exec is really much better (if you quote the
{} ;))
--
Dennis K.
Time is an illusion, lunchtime doubly so.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060829/8d5929a8/attachment.sig>
More information about the ubuntu-users
mailing list