Guest User

Untitled

a guest
Feb 22nd, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. lista=$(sudo find ~/teste -name "*2.bak")
  4. tamTotal=0
  5. logDir=~/teste/log.txt
  6.  
  7. for arq in $lista; do
  8.     tam=$(du -b $arq | cut -d"  " -f1)
  9.     tamTotal=$(expr $tamTotal + $tam)
  10.  
  11.     echo "Excluindo arquivo: " $arq
  12.     rm $arq
  13.     echo $arq >> $logDir
  14. done
  15.  
  16. echo $tamTotal >> $logDir
  17.  
  18. mail tuliomonteazul@gmail.com << cat $logDir
Add Comment
Please, Sign In to add comment