dotfiles/.local/bin/scripts/latest
2022-01-31 10:36:25 +01:00

8 lines
282 B
Bash
Executable file

#!/bin/sh -e
# Displays the latest files in the given directory or pwd
test "$1" = "-a" && all=true && shift
for f in "${@:-$PWD}"
do test $# -gt 1 && highlight "$f"
find "$f" -maxdepth 4 -type f -printf '%.16T+ %P\n' |
sort -r | $(test "$all" && echo "less" || echo "head")
done