modifiedfiles is a script to find which files of a given extension have been modifiled in the last N days, with current directory as the root for tree search, e.g., nb (Mathematica) files in the last month:
modifiedfiles --ext=nb --last=30
#!/bin/bash
# __ __ _ _ __ _ _ _____ _ _
#| \/ | ___ __| (_)/ _(_) ___ __| | ___(_) | ___ ___
#| |\/| |/ _ \ / _` | | |_| |/ _ \/ _` | |_ | | |/ _ \/ __|
#| | | | (_) | (_| | | _| | __/ (_| | _| | | | __/\__ \
#|_| |_|\___/ \__,_|_|_| |_|\___|\__,_|_| |_|_|\___||___/
# F.P. Laussy
# v°0.1 laussy.org/wiki/modifiedfiles
#
# modifiedfiles - List files of a given extension modified in the last N days
# (newest first, full absolute paths)
#
# Usage:
# modifiedfiles --ext=nb --last=30
# (or --ext nb --last 30, order doesn't matter)
#
# Searches recursively from the CURRENT directory.
# Outputs one full absolute path per line (most terminals make these clickable
# with Ctrl+Click or just click). Filename is part of the path.
EXT=""
DAYS=""
while [[ $# -gt 0 ]]; do
case $1 in
--ext=*)
EXT="${1#*=}"
shift
;;
--ext)
shift
EXT="$1"
shift
;;
--last=*)
DAYS="${1#*=}"
shift
;;
--last)
shift
DAYS="$1"
shift
;;
*)
echo "Unknown option: $1" >&2
echo "Usage: $(basename "$0") --ext=<ext> --last=<days>" >&2
exit 1
;;
esac
done
if [[ -z "$EXT" || -z "$DAYS" ]]; then
echo "Usage: $(basename "$0") --ext=<extension> --last=<days>" >&2
echo "Example: modifiedfiles --ext=nb --last=30" >&2
exit 1
fi
# Strip leading dot if someone passes .nb (harmless)
EXT="${EXT#.}"
DIR="$(pwd)"
# Find → timestamp + path → sort newest first → extract path
find "$DIR" -type f -name "*.$EXT" -mtime -"$DAYS" -printf '%T@ %p\n' \
| sort -nr \
| cut -d' ' -f2-