It’s not common for you to get one virus on a pen drive that hides folders and files, or turns them into shortcuts, leaving everything you had inside inaccessible. Calm down: there’s a way to recover your flash drive and the files inside with a few tricks, without having to format it.
This usually happens when you plug the device into some public computer and the flash drive catches the virus from that computer. There are a few different types of viruses, but the biggest problem encountered is when folders become shortcuts and you can’t access anything that was there before. If you right-click on the pen drive, go to Properties and see that there is space used, you will probably be able to recover your files. Turns out they are still on the flash drive, but in hidden mode.
Remove virus and recover pen drive on PC (Windows)
Before you take out the virus and recover your files from the pen drive, you need to see the hidden folders of your system and your device. To do this, follow the steps below:
- In Windows 8 or 10, hit the start button, search for Folder Options and hit Enter. On Windows 7 or lower, enter Start > Control Panel > Appearance and Personalization > Folder Options;
- uncheck the option “Hide protected operating system files” and select Show hidden files, folders and drives under Hidden Files and Folders;
- Click OK.
Now, delete the shortcuts that are on the flash drive (they are made to mimic folders), but be careful not to confuse them with your real files. The second step is to leave the files unhidden and access them normally. Follow the steps below:
- Hit the start button, type cmd and press Enter;
- Type the letter that indicates the drive of your flash drive followed by a colon (:). For example,
- then type
attrib -r -s -h /s /d D:\*.*also exchanging
D:by your drive letter;
- Press Enter.
Then, run some antivirus recommended in this post to remove the virus from the pen drive or computer and that’s it! It’s probably all right now. But, for your safety, it’s good to do some checks beforehand. After running the antivirus, make sure you don’t have any strange files on the flash drive that you’ve never put or seen before.
If you want to make sure your files won’t be compromised, copy them to your computer, format the flash drive following this tutorial and when the formatting is done copy the files back to the flash drive.
Remove virus and recover pen drive on Mac
There is also the possibility that you can use a Mac nearby to recover the flash drive. Follow the steps below to recover the files:
- open the app Terminal along the way Applications > Utilities > Terminal;
- enter the command
defaults write com.apple.Finder AppleShowAllFiles TRUE;killall Finder. Now you will be able to see the hidden files on the flash drive;
Now search all your folders and files among other strange folders and files. On the pen drive I accessed, all the files were inside a folder with a blank name, so I just had to copy everything to a folder inside my computer, format the pen drive to get rid of the virus and move the files again.
However, there is also the possibility of all files are hidden instead of being located in a single folder. If this happens, enter the Terminal again and follow the steps below:
- Type the command
chflags nohidden(that’s right, with a space after the command);
- drag the files which are hidden to the Terminal and then press enter;
- type it
defaults write com.apple.Finder AppleShowAllFiles FALSE;killall Finderto disable viewing of hidden files.
Ready! Files are no longer hidden. If you want to make sure you don’t get a virus again, delete extraneous files that you don’t remember putting, run the flash drive in some antivirus in Windows, or format it following this tutorial (but don’t forget to move the files out of the flash drive before!).