How to use find to handle large number of files

Reply

Join Date: Nov 2007
Posts: 8
Reputation: ashikin_8119 is an unknown quantity at this point 
Solved Threads: 0
ashikin_8119 ashikin_8119 is offline Offline
Newbie Poster

How to use find to handle large number of files

 
0
  #1
Oct 14th, 2008
Hi all;

I'm having problem with find command in listing large number of files in the current directory.

This is the code that i use:
find *.dat -prune | xargs ls -ltr

This command cannot handle large number of files and throwing this error msg:
ksh: /usr/bin/find: 0403-027 The parameter list is too long.

Someone please help, i really need it urgently. Thank you in advance.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 67
Reputation: Gromit is an unknown quantity at this point 
Solved Threads: 7
Gromit's Avatar
Gromit Gromit is offline Offline
Junior Poster in Training

Re: How to use find to handle large number of files

 
0
  #2
Oct 15th, 2008
Try using the built in exec command! Also, not sure if that's exactly what you're typing, but you'll need to give "find" a few more arguments...

find . -iname *.dat -prune -exec ls -ltr {}\;

What this does, bit by bit:

find - the command!

. - the starting point, in this case the cwd

-iname - we want stuff named x, and we dont' care about case (i = insensitive)

*.dat - this is the "x" we were talking about

-exec - execute this command on what we find!

-prune - prune stuff!

ls -ltr - this is the command to execute

{} - this get substited with the find results when the command is run

\; - end of exec statement

I hope this helps!

-G

P.S. I think you need to use "-depth" for prune to do what you want
Last edited by Gromit; Oct 15th, 2008 at 11:50 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Getting Started and Choosing a Distro Forum


Views: 1316 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Getting Started and Choosing a Distro
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC