poor-man antivirus

Hi all,
my usb key has been infected by a windows virus, so that now in all my folders I've got a .exe file with the same name of the folder itself. Removing them was quite easy, since I had no windows executable on the key:

Code:
find /media/usb -name '*.exe' -print0 | xargs -0 rm

I was thinking about a one liner that would ensure me to erase only those exe that have the same name of the folder they are into. Any idea?
 
fluca1978 said:
Nice, but probably it should be:

$ find /media/usb -type d -[b]execdir [/b]rm -f '{}'.exe \;
Why do you think the latter is better? I don't think it makes a difference in this case:
Code:
$ mkdir -p dir1/dir2/dir3
$ find dir1 -type d -exec echo '{}'.exe \;
dir1/dir1.exe
dir1/dir2/dir2.exe
dir1/dir2/dir3/dir3.exe
$ find dir1 -type d -execdir echo '{}'.exe \;
dir1.exe
dir2.exe
dir3.exe
Seems pretty much equivalent to me.

Fonz
 
You are right, they are equivalent.
I tend however to prefer the one that drops me in the directory since I feel a little more secure in the case I've mispelled any argument...
 
Back
Top