To remove viruses from a USB key infected during its adventure with windows, you can proceed in two ways:
1) format the key (you have to disable the autoplay on windows, to do that when you insert the key you hold down the Shift Key)
2) delete the infected files with a Mac.
Usually these files are locked and for that, before dragging them to the trash, you need to remove their protection.
Open the terminal and type:
sudo chflags -R nouchg
Thensimply dragthefileto unlockin to the terminal:
Press enterand insert youradministrator password, nowthe protection isremoved:
Theflags addadditional levels ofcontroltofilesthat sometimesneither the administrator of thecomputercanbe removed.To change theflagof the filesyou need to usethe commandchflags:
chflags — change file flags
chflags [-fhv] [-R [-H | -L | -P]] flags file …
The chflags utility modifies the file flags of the listed files as specified by the flags operand.
The options are as follows:
-R Change the file flags for the file hierarchies rooted in the files instead of just the files themselves.
Putting the letters “no” before or removing the letters “no” from a keyword causes the flag to be cleared.
nouchg clear the user immutable flag (owner or super-user only)