all my music albums sorted by date

Useful bit of shell for looking at my music library by age acquired:

find . -type d -links 2 -exec \
  stat -c "%Y %y %n" {} \;    \
| sort -n                     \
| cut -c 12-22,50-

The find shows all leaf directories. The stat command prints the file modified time for the directory in two formats. Sort by timestamp, then use cut to extract just the date and pathname from stat.

The find -links is said not to work in the MacOS bizarro filesystem. Works fine on Linux, didn’t test through an SMB mount.

I’m using the directory mtime, the good ol’ Posix way to sort of tell how old a directory is. Or rather, last time a file was added/removed from the directory (IIRC). The 20+ year legacy of Unix not really supporting creation times on files reliably. (Quick, what’s the difference between mtime and ctime? And why is atime such a bad idea for web servers?) ext4fs has a new attribute called “birth time” that looks useful, but the userspace tools still don’t know how to read it.