find (too many arguments)

Jonathan I. Kamens jik at athena.mit.edu
Thu Jan 11 18:51:56 AEST 1990


In article <388 at usdtsg.Dayton.NCR.COM>, musson at usdtsg.Dayton.NCR.COM (Scott
Musson) writes:
> when I do a 'find p* -mtime +1 -print'   in a directory with a large
number of
> files starting with 'p', I get find: too many arguments.
> 
> I can subdivide the list with smaller segments of the files I want to find,
> but I would like another way around this if possible.  Can anyone point me
> in the right direction?

  There is no way around it.  The shell has a built-in limit on the
number of arguments that can be parsed on the command line. 
Furthermore, there is a kernel limit on the number of arguments passed
into any particular program execution.

  You'll have to do your finding by breaking it up into smaller sets of files.

  I cannot resist pointing out that any directory that has so many files
into it that they can't be passed into find probably has too many files
in it and should be reorganized :-).

  Seriously, if the directory in question has no subdirectories, (or if
you want it to search the subdirectories too), you could do "find .
-name p\* -mtime +1 -print", which solves the problem.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list