procmail
[Top] [All Lists]

Re: ls Error

2000-05-18 07:31:53
On May 16, 10:48am, Emil Isberg wrote:
Subject: Re: ls Error
On Mon, 15 May 2000, SoloCDM wrote:
Recently I executed the following command:
    rm -f dummy "ls -t msg.* | sed -e 1,900d"

    bash: /bin/ls: Argument list too long
I know why (14,522 msg.* files exist in the directory), but I need a
solution.

Ouch. That's alot of files...
What about the following:
 rm -f dummy `ls -t .| grep '^msg\.' | sed -e '1,900d'`

this still has the problem that `ls -t | ...` will result
in too many args.

a nit: I don't think adding "dummy" is needed on "rm -f".
It won't complain, even if no args are given.

But, this should work fine:
 % ls -1t | grep '^msg\.' | sed -e '1,900d' | xargs rm -f

assuming the command is running in the directory where the
deletes will take place.

<Prev in Thread] Current Thread [Next in Thread>