[Petal] Petal temp files
Fergal Daly
fergal at esatclear.ie
Tue Feb 15 22:49:57 GMT 2005
On Tue, Feb 15, 2005 at 09:50:03PM +0100, Olaf Buwen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> find /tmp -name 'petal_*' -mtime +30 | xargs rm
>
> should find and delete all petal files in /tmp older than 30 days.
>
> but fear filenames like 'petal_fake;rm -rf ..;#ignore'
> if you feed the list to a shell script!
If you do
find /tmp -name 'petal_*' -mtime +30 -print0 | xargs -0 rm
then the -print0 for find will make it output \0 (ie the NULL character) as
the file separator instead of \n. -0 for xargs tells it to expect the files
to be separated by \0 instead of \n. This guarantees no funny with ;s or
spaces business because filenames cannot contain \0,
Fergal
More information about the Petal
mailing list