Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.42 KB | None | 0 0
  1. #Count files and sizes
  2. find ./*/spam/ -type f | echo "I found " `wc -l` "spams" \;
  3. du -shc ./*/spam/* | echo "Size of spams:" `grep total`
  4.  
  5. read -r -p "Do you want to delete ALL spams? [Yes/No] " response
  6. if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
  7. then
  8.     #Delete
  9.     find ./*/spam/ -type f -exec rm -rf ./*/spam/* {} \;
  10.     echo "Spams executed"
  11.     exit 1
  12. else
  13.     echo "We didn't delete anything"
  14.     exit 2
  15. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement