how to sort the linux find command by the path
Solution 1:
If you want content sorted, do it yourself. For a list of files, doing that safely means NUL-delimiting the names (so a file with a newline in its name doesn't get read as the names of two separate files and thus split apart during the sort process), and using sort -z
(a GNU extension).
while IFS= read -r -d '' entry; do
printf 'Processing: %s\n' "$entry"
done < <(find . -type f -print0 | sort -z)
See Using Find for guidance on using find
reliably, and BashFAQ #1 for a discussion of the while read
construct used here.