[nflug] rm Limitations
Darin Perusich
Darin.Perusich at cognigencorp.com
Mon Jun 23 15:01:13 EDT 2008
Ken Smith wrote:
>
> That said in addition to the xargs suggestion you could do:
>
> cd ..
> rm -rf directory-you-were-in
> mkdir directory-you-just-removed
>
> (assuming there weren't any "dot" files in that directory you wanted to
> preserve - they wouldn't have matched the wildcard...).
>
Removing the parent directory can be problematic in instances where say
a daemon is writing files to said location. I run into this on email
gateways running amavisd-new where the quarantine directory is
continuously getting new spam and virii files added to it. Removing
/var/spool/amavis/virusmails while amavisd-new is running would be very
bad. Much like removing and touching a file syslog has open, all of a
sudden the file is empty but nothing new is written to is and the file
system continues to fill up! I did this *once* a many moons ago and it
took a while to figure out what was happening.
The first works with GNU find, I'm not sure about *BSD.
find /var/spool/amavis/virusmails -type f -delete
find /var/spool/amavis/virusmails -type f -exec rm -f {} \;
--
Darin Perusich
Unix Systems Administrator
Cognigen Corporation
395 Youngs Rd.
Williamsville, NY 14221
Phone: 716-633-3463
Email: darinper at cognigencorp.com
More information about the nflug
mailing list