I have directory IXNPG7 under which i have seen file ads[1].c , ads[1].gif ,
ads[1].js and lots more with extension .html
I tried to remove the Entire Directory with rm -Rf IXNPG7
but it is saying -- Directory Not empty can't remove
Secondly i tried removing all the files first
using rm *.* inside that directory all files get removed except ads[1].c
i tried to remove using rm -fr ads[1].c --after issuing the command the
rm is silent with out any error,but not able to delete this file ?
1 -- Can you please tell me why the directory is not removed recursively
2-- Why this FILE is not removing ?
3- Some time this directory contains a file whose name more then 1 line of characters and denied removing saying too long file name ?
You could try putting the filename in single quotes, like:
rm 'ads[1].c'
I think the shell is trying to interpret the "[1]" as a pattern to match any single character within the square brackets (ie. you are trying to remove the file ads1.c).
I have tried all the above recomended option to delete the file and Folder
but those folder and file are not able to remove from cygwin using the rm command ,
But when i am trying to open the internet explorer property and remove all the offline contents then only it is removing.
Please suggest
I have seen that these are the virus file generating jsut by connecting to Internet.
I want to remove these file in every 10 sec by writing a UNIX script in cygwin.
these file are getting created in /cygdrive/c/Document and setting/user/local setting/Temporary Internet files
presently i have wriiten the script to check the desktop.ini file in this directory and the SUBfolder in this directory.
It is removing the desktop.ini but not able to remove the subfoder -- here is the script i am using ---
---------------------------SCRIPT----------------
#!/bin/sh
VIRUS_DIR="/cygdrive/c/Documents and Settings/User/Local Settings/Temporary Internet Files/Content.IE5/"
vf_1="ads[1].c"
vf_2="6[1].gif"
vf_3="desktop.ini"
while true
do
##########################################
cd "$VIRUS_DIR"
echo "Current Directory now " `pwd`
if [ -f $vf_1 ]
then
rm -fr ${vf_1}
if $? -eq 0
then
echo "Virus found $vf_1 and removed "
fi
else
echo "No virus file $vf_1 now "
fi
##########################################
if [ -f $vf_2 ]
then
echo "Virus found $vf_2 "
rm -fr $vf_2
else
echo "No virus file $vf_2 now "
fi
########################################
if [ -f $vf_3 ]
then
echo "Virus found $vf_3"
/usr/bin/rm -f desktop\.ini
if [ $? -eq 0 ]
then
echo "Virus ${vf_3} removed successfully"
fi
else
echo "No such virus file found "
fi
############################################
# echo "Now removing unnecessary directory"
for i in *
do
if [ -d $i ]
then
cd $i
rm -fr *
if [ $? -eq 0 ]
then
echo "Removed all file from $i directory "
else
cd ..
chmod 000 $i
continue
fi
cd ..
rm -fr $i && echo "Removed directory $i "
fi
done
echo "Looking back and checking desktop-ini-virus"
cd ../
if [ -f $vf_3 ]
then
echo "Virus found $vf_3 in " `pwd`
/usr/bin/rm -f desktop\.ini
if [ $? -eq 0 ]
then
echo "Virus ${vf_3} removed successfully"
fi
else
echo "No such virus file found "
fi
if [ -f ads.js ]
then
rm -fr ads.js
if [ $? -eq 0 ]
then
echo "Virus : ads.js found and removed "
fi
fi
echo "Sleeping for 10 seconds ......"
sleep 10
done