Skip to content

Instantly share code, notes, and snippets.

@2ec0b4
Created November 1, 2014 14:53
Show Gist options
  • Save 2ec0b4/e6a324d32d23c78ae900 to your computer and use it in GitHub Desktop.
Save 2ec0b4/e6a324d32d23c78ae900 to your computer and use it in GitHub Desktop.
Find the 10 last modified files of a directory
#!/bin/bash
cd /path/to/dir/
find . -type f -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -10 | cut -f2- -d" "
# or with modification time
find . -type f -print0 | xargs -0 stat -f "%m %t%Sm %N" | sort -rn | head -10 | cut -f2-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment