xeritt

Delete all files without extention and *.o

Dec 3rd, 2021
1,240
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. PWD=$(pwd)
  3. echo "C remove. Delete all files without extention and *.o"
  4. echo "Work dir: [$PWD]"
  5. if (whiptail --title  "Answer please Yes/No" --yesno  "Do you realy wan't delete all files without extention in $PWD" 10 60)  then
  6.     ##echo "You chose Yes. Exit status was $?."
  7.     echo "Delete files without extention";
  8.     files=$(ls | grep -v '\.')
  9.     for entry in $files
  10.     do
  11.         if [ $entry = "Makefile" ]; then
  12.             echo "No delete Makefile"
  13.         else
  14.             echo "Delete file "$entry
  15.             rm -f $entry
  16.         fi
  17.     done
  18.     echo "Delete files with .o extention";
  19.     rm -f *.o
  20. else
  21.      echo "Exit whithout action. Exit status=$?"
RAW Paste Data