Guest User

Untitled

a guest
Feb 25th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. dir_to_check='/root/temp/somedir'
  4.  
  5. last_month=$(date -d "-1 month -$(($(date +%d)-1)) days" +%Y-%m-%d)
  6.  
  7. find "$dir_to_check" ! -newermt "$last_month" -type f -exec rm {} ;
Add Comment
Please, Sign In to add comment