mirror of
https://github.com/mr0xb/scripts.git
synced 2026-08-27 19:34:57 -04:00
22 lines
511 B
Shell
Executable file
22 lines
511 B
Shell
Executable file
#!/usr/bin/env bash
|
|
|
|
# Show most recently modified files under a directory
|
|
# Default: $HOME
|
|
|
|
DIR="${1:-$HOME}"
|
|
COUNT="${2:-20}"
|
|
|
|
if [[ ! -d "$DIR" ]]; then
|
|
echo "Usage: $0 [directory] [count]"
|
|
exit 1
|
|
fi
|
|
|
|
echo "📁 Directory: $DIR"
|
|
echo "🔢 Showing $COUNT most recent files"
|
|
echo
|
|
|
|
find "$DIR" -type f -printf "%T@ %TY-%Tm-%Td %TH:%TM:%TS %p\n" 2>/dev/null \
|
|
| sort -nr \
|
|
| head -n "$COUNT" \
|
|
| awk '{ timestamp=$2" "$3; $1=""; $2=""; $3=""; sub(/^ +/, ""); print timestamp " -> " $0 }'
|
|
|