Mail Archives: cygwin/2002/07/03/10:22:35
To generate a list of all files on my e: partition:
find e:/ -type f >c:/backups/filenames/edrive-files
However, this "find" command consistently stops before even
starting to read the final directory (462 MB large, with
19,000 files). When I use the MKS version of the find command
it reads this directory along with the others with no problem.
I had earlier had a problem with "grep foobar *" under
Cygwin (but again, not with MKS) and it turned out to be an
understandable and known limitation easily resolvable by using
"xargs" (see below). And in the case of grep, I was warned by
an error message of the problem with grep.
In the case of "find", the command line itself is not (I
should think) expanding into something too big to process,
but I was assuming that find was in fact designed to plow
through long directory trees. Even if this is not the case,
it's not clear to me how xargs could provide a workaround here.
This problem with "find" seems particularly insidious because
it executes and exits with no error message so I naturally
assume it has completed its work successfully -- even when
this is not the case. Since in other contexts I rely on
"find" to help back up my data files, the consequences of
an undetected error such as the one described above could be
disastrously disruptive to my work.
Has anyone else had this problem?
Tom
On Wed, Jun 26, 2002 at 12:37:10PM +0100, Conrad Scott wrote:
> "Thomas Baker" <thomas DOT baker AT bi DOT fhg DOT de> wrote:
> > One difficulty I have found, however, is limitations (or so
> > it would seem) on the number of arguments that the command
> > "grep" can take.
>
> You can't (portably) rely on anything much more than a few thousand
> characters in a single command line. The minimum requirement for a
> Posix system is 4096 (see <limits.h>). The usual technique is to use
> `xargs', as:
>
> ls | xargs grep pattern
>
> (or even `ls | xargs grep pattern /dev/null' to catch the case with
> only one argument being given to grep and it changing behaviour).
>
> This splits up the incoming arguments and invokes grep repeatedly, a
> batch of the arguments at a time. It's particularly useful with `find'
> and it's got lots of lovely options to play with too :-)
>
> It would be nice to allow arbitrary command lines, but I've never
> (knowingly) used a system that did so.
>
> // Conrad
>
>
>
--
Dr. Thomas Baker Thomas DOT Baker AT bi DOT fhg DOT de
Institutszentrum Schloss Birlinghoven mobile +49-171-408-5784
Fraunhofer-Gesellschaft work +49-30-8109-9027
53754 Sankt Augustin, Germany fax +49-2241-144-1408
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -