[TriLUG] find and rm command

Jeremy Portzer jeremyp at pobox.com
Thu Jul 15 16:49:27 EDT 2004


On Thu, 2004-07-15 at 15:54, Tobias Gloth wrote:

> Also, as others have said, with combinations of find and rm, it's good to
> be paranoid.  So, leave away the -r on rm.  It's also good practice to only
> find files and skip directories.
> 
> So, this might be a better solution:
> 
> find /home/directory -name thumbs.db -type f -print | xargs rm -f
> 

This may have already been mentioned, but always test your commands
first before running them, if you're planning on deleting things.  It's
simple to modify the above:
	find /home/directory -name thumbs.db -type f -print |
	echo xargs rm -f

This will just output the commands that will be excuted, with "echo,"
rather than actually deleting anything.  Then, if you're sure it's what
you want, re-run the command without the echo.

Hope this helps,
Jeremy

-- 
/---------------------------------------------------------------------\
| Jeremy Portzer        jeremyp at pobox.com      trilug.org/~jeremy     |
| GPG Fingerprint: 712D 77C7 AB2D 2130 989F  E135 6F9F F7BC CC1A 7B92 |
\---------------------------------------------------------------------/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20040715/ea261fb6/attachment.pgp>


More information about the TriLUG mailing list