improve performance by using ls better than find

Hi ,

i'm searching for files over many Aix servers with rsh command using this request :

find /dir1 -name '*.[nN][sS][fF]' -exec ls {} \;
and then count them with "wc"

but i would improve this search because it's too long and replace directly find with ls command but "ls *.[nN][sS][fF] " doesn't work.

and the search must be recursive in sub-directories !

anybody has an idea ? i'm searching too..........

Thanks in advance

Christian

find /dir1 -name '*.[nN][sS][fF]' -print

will be much faster. Your command is launching a "ls" process for each file that it finds. But searching a large collection of files is going to take some time.

And the find command will beat any ls -R command. Remember that ls will sort the output while find does not.

Thanks Perderabo ,

some little tries with timex command (under AIX) show quickly the gain i get for my treatment.

and thanks for the explanations , the solution is not the only purpose !

regards
christian

# find / -print | grep -i .nfs

greetings pressy