2021-11-25 13:20:13 +01:00
|
|
|
#!/bin/sh -e
|
2023-11-04 19:08:39 +01:00
|
|
|
# Lists the latest modified files in the given directory or pwd
|
2025-06-08 12:15:07 +02:00
|
|
|
# up to a depth of 4
|
|
|
|
count=5
|
|
|
|
case "$1" in
|
|
|
|
(-a) all=true; shift;;
|
|
|
|
(--) shift;;
|
|
|
|
(-*) args="$1 $2"; shift 2;;
|
|
|
|
([0-9]) count=$(expr $1 \* 10); shift;;
|
|
|
|
esac
|
|
|
|
|
2022-01-31 10:36:25 +01:00
|
|
|
for f in "${@:-$PWD}"
|
2025-06-08 12:15:07 +02:00
|
|
|
do test $# -gt 1 && { highlight "$f" || echo "$f"; }
|
|
|
|
find "$f" -maxdepth 4 $args -printf '%.16T+ %P\n' |
|
|
|
|
sort -r | $(test "$all" && echo "less" || echo "head -$count")
|
2021-12-12 20:24:56 +01:00
|
|
|
done
|