hiiii folks...
some time u have been facing prob in windows that due to some virus aur intruders attack there is an .exe file created in every folder with the same name as the folder..
it is very cumbersome to delete all those files manually...
my suggestion is if ur system is dual boot system..
1.) goto ur linux box..
2.) mount ur windows drives..
3.) become root user with su on fedora,redhat,mandriva or sudo su on ubuntu..
3.) run thd following command...
find / -name "*.exe" -print | awk -F"/" '{split($NF,a,"."); if($(NF-1)==a[1]){ print $0}}'
it will print all those files on your system any where which has the same name as its folder name.
4.) after inspecting the output if u r satisted ..
5.) run again the following command
find / -name "*.exe" -print | awk -F"/" '{split($NF,a,"."); if($(NF-1)==a[1]){ print $0}}' | xargs rm -f
friends u will not believe !.. it will wipe out ur all such files on your system in one go..
I think it will be useful..
Enjoy Linux !!...
if you find it is useful plzzzzzz do comment on this post !!...
Subscribe to:
Post Comments (Atom)
I think ranjeet you should use the " " in print statement in the awk otherwise it not run properly
ReplyDeletefind / -name "*.exe" -print | awk -F"/" '{split($NF,a,"."); if($(NF-1)==a[1]){ print "\""$0"\""}}' | xargs rm -f
now it work properly
there is another method for doing the same thing is
find /media/Misc/ -name "*.exe" -print|awk 'BEGIN{FS="/"};{if($(NF-1)==substr($NF,0,(length($NF)-3))){print "\""$0"\""}}'|xargs rm
it also work and remove only that file which name is same as the folder name due to folder.exe virus.............