...making Linux just a little more fun!

### how 2 delete large num of files

Ramachandran Iyer [riyer at kodiaknetworks.com]
Thu, 22 Feb 2007 12:26:39 +0530

Hi, I have some 40,000 entries/files in a directory I know there is some combinations or rm & xargs to delete this long list,, I am not getting the exact syntax. Can u pl pass it on,, Rama

Top Back

Thomas Adam [thomas.adam22 at gmail.com]
Thu, 22 Feb 2007 08:43:14 +0000

On Thu, 22 Feb 2007 12:26:39 +0530 "Ramachandran Iyer" <riyer at kodiaknetworks.com> wrote:

    > Hi,
    >  I have some 40,000 entries/files in a directory I know there is some
    > combinations or rm & xargs to delete this long list,, I am not getting
    > the exact syntax.
    >  Can u pl pass it on,,

    find /some/directory -type f -print0 | xargs -0 rm -f

-- Thomas Adam

Top Back

Ben Okopnik [ben at linuxgazette.net]
Sat, 24 Feb 2007 15:53:03 -0500

On Thu, Feb 22, 2007 at 12:26:39PM +0530, Ramachandran Iyer wrote:

    >
    > Hi,
    >
    >  I have some 40,000 entries/files in a directory I know there is some
    > combinations or rm & xargs to delete this long list,, I am not getting the
    > exact syntax.

You could always read the man page. It includes examples.

    ls|xargs -L 1000 rm

    --
    * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

Top Back