[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fast way to delete a directory recursively



Patrick Hsieh <pahud@pahud.net> writes:

> Hello list,
> 
> I have some directories which are usually more than 10GB in size.
> If I want to delete them immediately, is there any fast way except for
> rm -rf <dir>?

Depends on the situation.  In the general case, no.  However, there may be
some other alternatives:

  - If the directory structure in question is the only thing on a
    partition, then umount-mke2fs-mount *may* be faster.  (Substitute the
    appropriate filesystem type, of course.)

  - If you're trying to delete the directory structure to make way for a
    new one with the same name, then you can do something like this:
        mv current old
        /bin/rm -rf old &
        ## start re-creating current.

    Doesn't make the actual deletion take any faster; it just parallelizes
    the process.

That's pretty much all I can think of, although there may be other
alternatives.

Richard


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: