Skip to content

Instantly share code, notes, and snippets.

@BrianRossmajer
Last active January 3, 2019 21:01
Show Gist options
  • Save BrianRossmajer/f3c01ad2eff1dc23f17fc9b5c3de2df8 to your computer and use it in GitHub Desktop.
Save BrianRossmajer/f3c01ad2eff1dc23f17fc9b5c3de2df8 to your computer and use it in GitHub Desktop.
Find the newest file in a subdirectory tree
perl -MFile::Find -e 'sub w{my $t=(stat _)[9];if ( -f _ && $t>$newest){ $newest=$t;$file=$File::Find::name;}} find(\&w,(shift or ".")); print $file," ",$newest;' <dir>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment