On Friday 07 Mar 2003 6:04 pm, Mithun Bhattacharya wrote:
> --- Arvind <[EMAIL PROTECTED]> wrote:
> > i have 19201 files in my directory.
> >
> > each time i issue the command, i am getting an error.
> >
> > #  rm -rf *
> > bash: /bin/rm: Argument list too long
>
> Even though Arvind has already got his answer I just felt like giving
> the "right" ways of handling the "unix" problem ;).
>
> find . -exec rm -rf {} \;
>
> cd .. ; rm -rf <name of the directory>
>
> I believe the suggested answer of using xargs wont work since it will
> again pass 19201 args to rm ??

No. xargs will construct a command using a line in input and pattern.  So it 
will call rm 19201 times with one file at a time. Slow but better than not 
working..

It is in essense, for i in `ls *` ; do rm -f "$i"; done. But I don't know if 
bash/sh/ksh will choke om having so many items in the item list.

But you got  the idea right?

 Shridhar



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to