Sort A Directory and Subdirectories By Date

It’s easy to sort a single directory by date in Linux with the ls command. Here’s how to sort a directory and its subdirectories by date:

find Music/ \
| xargs -d"\n" -i{} \
echo "stat --printf="%y\t%z" "{}" \
&& echo "\t{}"" \
| sh \
| sort

If piping arbitrary text through the shell makes you nervous, try it without the |sh |sort beforehand.