Skip to content

Instantly share code, notes, and snippets.

@nutrino
Last active February 11, 2023 16:04
Show Gist options
  • Save nutrino/8df8d124db418ed4a8c9b16df016e299 to your computer and use it in GitHub Desktop.
Save nutrino/8df8d124db418ed4a8c9b16df016e299 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -z "$1" ]; then
echo "list_old_files.sh [files_to_find]"
exit 1
fi
set -x #echo on
## remove files older than specific date
#find . -type f -name "$1" ! -newermt "2022-12-31 23:59:59" | xargs -I{} rm -f {}
# remove files older than 60 days
#find . -type f -name "$1" ! -mtime -60 | xargs -I{} --no-run-if-empty rm -f {}
find . -type f -name "$1" ! -mtime -60 | xargs -I{} --no-run-if-empty ls {}
#(find . -type f -name '$1' '!' -mtime -100) | xargs -I{} --interactive --no-run-if-empty ls {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment