LINUX - script to delete problematic files and folder

BE VERY CAREFUL!!!

SCRIPT TO DELETE PROBLEMATIC FOLDERS AND FILES
==============================================

* i had a problem where everything in the current folder wouldnt delete and then the system would turn readonly on me after deleting a few items
* be careful with this, im not responsible if you lost all of your files, thats what this is supposed to do
* the ls | wc -l tells you how many files are in the directory you want that to be 0, if you modify it to ls -a | wc -l to show all the hidden files then you know your done when it says 2 (one for . and one for ..)


#!/bin/bash
while true
do
mount -o rw,remount /dev/sdb1
rm -rf *
ls | wc -l
sleep 0.1
clear
done

* might need to remove the ".*" in some systems that tries to delete .. which the previous directory, so if your in /etc and do the rm -rf * .*, after it gets done deleteing everything *, it moves on to all the hidden files .* and sometimes into the previous directory .. which is / root, bad idea... so make sure you know what your doing

#!/bin/bash
while true
do
mount -o rw,remount /dev/sdb1
rm -rf * .*
ls | wc -l
sleep 0.1
clear
done
Comments