Search This Blog

Friday, January 30, 2009

Script to delete unwanted files

for eg to del all files ends with tilde (*~)

locate *~ > vik

a file vik is created with all such files.

Now run script
----------------

for i in `cat vik`
do
echo -e "--------------------------"
#echo -e "Delete File $i [y/n] "
#read dk
#if [ "$dk" = "y" ] ; then
rm -f $i
#echo -e "File $i deleted."
echo -e "--------------------------"
#fi

#sleep 1
done


--------------------
If u remove comments, It will ask you [y/n] every time before deleting the file.

No comments:

Post a Comment