[oclug] how to delete massive number of empty files?
Dave O'Neill
dmo at acm.org
Thu May 16 12:04:16 EDT 2002
On Thu, May 16, 2002 at 11:32:16AM -0400, Jeff 'Gooey' East wrote:
> Well, that was odd. The logrotate util wasn't properly making
> backup copies of my web server log files. In short, every iteration it
> would geometrically increase the number of backups. It just used up the
> last inode on it's partition, and all hell broke loose.
>
> So, I figured I'd just "rm httplogfile.*". Well, I got "arguement
> list too long". So for the past 20 minutes I started with "rm
> httplogfile.1.gz.1.gz.1.gz.1.gz.4.gz*" and worked it down, for both access
> and error logs.
>
> So, given that I've corrected the mis-configured logrotate conf
> file, how can one delete all those empty files more easily should it happen
> again?
'find' and 'xargs' are very useful in this case. Something like:
find /dir/containing/logfiles/ -name httplogfile.\* | xargs rm
might do the trick for you. Replace /dir/containing/logfiles with the
appropriate dir, of course.
-dave0
--
('>
//\ dmo at acm dot org
v_/_
More information about the OCLUG
mailing list