bash: /usr/bin/rm: Argument list too long

Morten Kjarulff MKJ@dk.ibm.com
Mon Aug 22 12:57:00 GMT 2005


Hi,

If I try to rm many files, or fewer files with long names I get "bash:
/usr/bin/rm: Argument list too long". Can anyone tell the limits?

Is the solution something like "for file in * ; do rm $file ; done"?

/Morten

The directory is empty:
mkj008@mcmkj01w /tmp
$ ls

mkj008@mcmkj01w /tmp

1000 files named f1,f2,f3,.. is ok:
mkj008@mcmkj01w /tmp
$ for (( i=1 ; $i<=1000 ; i=$i+1 )) ; do echo >f$i ; done

mkj008@mcmkj01w /tmp
$ rm *

10000 files named f1,f2,f3,.. is not ok:
mkj008@mcmkj01w /tmp
$ for (( i=1 ; $i<=10000 ; i=$i+1 )) ; do echo >f$i ; done

mkj008@mcmkj01w /tmp
$ rm *
bash: /usr/bin/rm: Argument list too long

Delete the files with windows:
mkj008@mcmkj01w /tmp
$ cmd
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

D:\cygwin\tmp>del /q *

D:\cygwin\tmp>exit

1000 files with long names is not ok:
mkj008@mcmkj01w /tmp
$ for (( i=1 ; $i<=1000 ; i=$i+1 )) ; do echo
>ffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff$i ; done

mkj008@mcmkj01w /tmp
$ rm *
bash: /usr/bin/rm: Argument list too long

same thing for ls:
mkj008@mcmkj01w /tmp
$ ls *
bash: /usr/bin/ls: Argument list too long

(See attached file: cygcheck.out)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 15950 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050822/1517ef77/attachment.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list