Ever trying to remove a lot of file like this ?

[root@blah]# ls -l log/ | wc -l

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

[root@blah]# 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, will not be published)