How long is too long? How many files are there?
You could try the locate command. If that's still to slow, you may need a different filesystem.
(Or better yet, a different organization of your files.)
Thank you for the prompt reply.
The query takes about 1-2 seconds per server. Considering this is running on 10 severs for example, without threads it could take up to 20 seconds for a full query.
I do use threads and have been able to get it down to about 5-8 seconds, but again this is quite slow.
Also locate looks very fast, however I'm unsure how to prevent it from recursing.
Where does the extra time between 1-2 seconds per server vs. 5-8 seconds for a threaded lookup on all servers come from? Are you doing communication between servers, or are the filesystems from all the servers available locally? If the later, is nfs or whatever actually slowing things down compared to a solution using ssh?
To "prevent" locate from recursing, filter the results looking for your specific directory.