wjandrea

Revision of https://askubuntu.com/q/1127544/301745

Mar 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. find . -maxdepth 1 -type f -size +1M |
  4.     while read -r filename
  5. do
  6.     echo "$filename"
  7.  
  8.     read -r -p "Delete the file? [Y/n] "
  9.  
  10.     case $REPLY in
  11.     [yY])
  12.         echo "Skipping deletion for testing purposes."  # TESTING
  13.         # rm -v -- "$filename"  # TESTING - commented out
  14.         ;;
  15.     [nN])
  16.         echo "Skipping deletion."  # TESTING
  17.         ;;
  18.     *)
  19.         echo "Invalid input: $REPLY"
  20.         exit 1
  21.         ;;
  22.     esac
  23. done
Add Comment
Please, Sign In to add comment