Ever trying to remove a lot of file like this ?

[[email protected]]# ls -l log/ | wc -l
2041335

It wont work if you just remove it with rm because there will be an error message (i.e. /bin/rm: Argument list too long). So how to remove it ?? I use this command to remove it

[[email protected]]# find ./ -name ‘msg.*’ | xargs rm -fv

I’m using msg.* becasue the filenames I want to remove begin with msg.. You can vary it depend on your need.

source of inspiration

1 Komentar

  • At 2010.02.16 17:08, Meti said:

    for x in `ls`; do rm -f $x; done
    bisa juga :D

    (Required)
    (Required, will not be published)