Skip to content

Instantly share code, notes, and snippets.

@trepmal
Last active July 2, 2019 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trepmal/066d3eccd912c715e1e0564761f421d5 to your computer and use it in GitHub Desktop.
Save trepmal/066d3eccd912c715e1e0564761f421d5 to your computer and use it in GitHub Desktop.
# Find your files in /tmp older than 7 days
find /tmp -mtime +7 -user `whoami` -exec ls -lpdh {} \; | column -t
# Delete your files in /tmp older than 7 days
find /tmp -type f -mtime +7 -user `whoami` -delete
find /tmp -type d -mtime +7 -user `whoami` -empty -delete
# Find your files in /home (2 dirs deep) older than 7 days
find /home -maxdepth 2 -mtime +7 -user `whoami` -exec ls -lpdh {} \; | column -t
# Delete your files in /home older than 7 days
find /home -maxdepth 2 -type f -mtime +7 -user `whoami` -delete
find /home -maxdepth 2 -type d -mtime +7 -user `whoami` -empty -delete
# make file.txt seem less old
touch file.txt
# recursively make all files in directory/ less old
find directory/ -exec touch {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment