Advertisement
MrSnoopy

cleanup by age

Jul 19th, 2021
1,347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.42 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. ## Script will cleanup the location from the directories at LOCATION older than DAYSLIMIT days  
  4.  
  5. #define days in ctime
  6.  
  7. DAYSLIMIT=30
  8. LOCATION="/mnt/c/Users/xxxvo"
  9.  
  10. find ${LOCATION} -type f -ctime +${DAYSLIMIT} |while read folder; do
  11.     echo "${folder}"
  12.       ##delete
  13.       #rm -rf "${folder}"
  14.       ##TEST- print only
  15.       echo "rm -rf ${folder}"
  16.       #echo "${folder}"
  17. done
  18. exit 0
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement