Friday, September 16, 2005

Summary: probably over a million files to delete

Subject: Summary: probably over a million files to delete

Thanks all.

Some of the replies :

A couple replies say I will still some time to complete the
deletion, so I probably can do
"nohup <delete command> &
to let it run by itself in the background.

As I need to remove files older than 180 days, I chose :

cd <dir where files exist>
find . -xdev -type f -mtime +180 -exec rm {} \+ &

==========

Other replies :

Mount the filesystem with logging on. You can do this without
unmounting
the filesystem
mount -o remout,logging <dev> >filesystem>

-----------

cd <directory>
find . -name '*2004*12' -o -name '*2004*11*' -o .... | xargs rm -f &

-----------

1. find . -exec rm {} \;
2. for x in `ls`; do rm $x ; done

-----------

You ran into a limitation on the ability of the shell. I have run into
similar problems in the past. Here is how I worked around it. It
requires the use of perl. It will remove all files within the
directory
where executed. Test to verify for yourself how it works.
ls | perl -ne 'chomp; unlink'

0 Comments:

Post a Comment

<< Home