Mail Archives: cygwin/2005/08/22/09:16:38
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Morten Kjarulff on 8/22/2005 6:56 AM:
> 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?
The limits are pretty low if you are using Windows mechanisms, although I
don't know the exact limit (they can be increased by mounting /bin as
cygwin-executable, but even then still have limits). But generally, if
you are trying to pass that much data on the command line, there is
usually a better solution that does not even expand the wildcard.
>
> Is the solution something like "for file in * ; do rm $file ; done"?
It is, if you don't mind doing it one file at a time.
If you don't mind deleting the directory, there is always this (let rm do
the recursion, instead of calling out every file yourself):
cd .. && rm -R tmp
Or if you want to delete as fast as possible without surpassing
command-line limits, there is this (it works, since echo is a shell
builtin, and since xargs is getting the list from stdin and not the
command line, then calling rm as many times as needed with a group of
filenames as command-line arguments):
echo * | xargs rm
By the way, this is not a cygwin-specific problem, it is just that cygwin
tends to have a smaller command-line limit than many other platforms.
>
> same thing for ls:
> mkj008 AT mcmkj01w /tmp
> $ ls *
See the coreutils FAQ - 'ls' is MUCH more efficient than 'ls *', and does
the SAME THING!
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Argument-list-too-long
- --
Life is short - so eat dessert first!
Eric Blake ebb9 AT byu DOT net
volunteer cygwin coreutils maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDCdAm84KuGfSFAYARAnHtAJ9x3fynt113ri0ZYSFxmLkrYKT4rwCfffhs
zLXtaL1CGL4Yu3aekRGYH14=
=b+Y1
-----END PGP SIGNATURE-----
--
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/
- Raw text -