dotfiles/.local/bin/scripts/latest

9 lines
288 B
Text
Raw Normal View History

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
2021-12-02 23:33:22 +01:00
test "$1" = "-a" && all=true && shift
2022-01-31 10:36:25 +01:00
for f in "${@:-$PWD}"
do test $# -gt 1 && highlight "$f"
find "$f" -maxdepth 4 -type f -printf '%.16T+ %P\n' |
2021-12-02 23:33:22 +01:00
sort -r | $(test "$all" && echo "less" || echo "head")
done