When find
iterates directories, they show up in the order the VFS yields them. Can this order be changed to first traverse directories before looking at files placed beside them?
The -depth
option is not the solution. It only changes
$ find
.
./afile
./directory
./directory/athirdfile
./other-directory
to
$ find -depth
./afile
./directory/athirdfile
./directory
./other-directory
(Note how only the second and third output line swapped places.)
This question instead seeks for a way to produce the following order.
./directory/athirdfile
./directory
./other-directory
./afile