Created
October 27, 2017 11:21
-
-
Save ElectricCoffee/46c84a78dfbddd0ef581ef73a6faf0b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cleanup() { | |
count=0 | |
filename=$1 | |
for file in $(find .); do | |
if [ -f $file ] && [[ $file =~ $filename || $file == $filename ]]; then | |
let "count++" | |
fi | |
done | |
echo "Are you sure you want to delete $count files?" | |
select yn in Yes No; do | |
case $yn in | |
Yes)# Skip down to the for loop below | |
break;; | |
No) echo "Okay, no files removed." | |
return;; | |
esac | |
done | |
for file in $(find .); do | |
if [ -f $file ] && [[ $file =~ $filename || $file == $filename ]]; then | |
echo removing $file | |
# rm $file | |
fi | |
done | |
echo "removed $count files" | |
unset count | |
unset filename | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment