I am wondering if there is a way to run the find
command and make it go through the directories (recursively) in alphabetical order (or in reverse)? I have a bunch of directories with names representing some order and often I need to find the earliest (or the last) based on the directory name.
There are questions and answers on how sorting the results returned by find
(see below). However, I am interested to know if there is a way to make find
to run the search alphabetically because it would be much more efficient than going through the whole thing and then sort.
Ideally, I can specify the command to stop after n
hits are found, but that's secondary because I can also stop the command manually.
How do I get files found by command-line 'find' ordered by modification date in OS X? https://unix.stackexchange.com/questions/34325/sorting-the-output-of-find