Recover Data from virus infected empty Pendrive

Recently I shared my 4 GB SanDisc pen drive for transferring some data from my PC to a laptop. I knew that the laptop was infected with viruses.  I did not hesitated about sharing my pen-drive because I was quite confident that AVG antivirus will take care of any migrant virus.  I generally use AVG Free for home use version.  Its as good as paid version of Norton AntiVirus and McAfee Anti-Virus software. If at any time the viruses doom all anti-virus software, I switch to Linux OS, mainly to Ubuntu OS or Kubuntu OS.
When I got my pen drive back it showed all folders as shortcuts and AVG detected malicious programs on it. After AVG scanned my pen-drive and applied preventive measures all the data disappeared from pen drive. At first I thought of formatting the pen-drive but on second thought, I searched google for recovering data from virus infected pen-drive and got a working solution. Which I am sharing here in this blog post for you and for my own reference in future. Assuming that your computer is run on windows platform like Win XP, Win 7, Windows 8 etc.
Step 1. Click Start > then choose RUN. (basically open command prompt window)
Step 2. type CMD in open command form.
Step 3. type cd.. and press enter till you reach C:/ only
Step 4. type your pendrive letter (find the drive letter in windows explorer) e.g. C:/ E: and then press enter
Step 5. You will see E:\> in command window. now type this line
attrib -h -s /s /h *.* and press enter
Now wait for 1 to 2 minutes and then open your pen drive in My Computer window. hopefully you will see all the data is still present in your pen drive.

Further update :

if you got invalid switch – /h error on above command that means your USB drive has created a shortcut link and all files have been moved under that link. If you face this problem with your USB drive then follow these steps as mentioned here under

Step 1. Click Start > then choose RUN and type CMD in open command form. (basically open command prompt window)
Step 2. if your USB drive letter is E drive under My Computer window, then you need to type E: and press Enter key. Now you will see E:/>  which is the USB drive inside the command prompt.
Step 3. type del *.lnk and press Enter key this will delete all files with the extension of a shortcut
Step 4. type attrib -h -r -s /s /d E:*.* and then press Enter. It will change the attributes of all the files and you will see a name less folder icon in your USB drive
Step 5.  double click that folder and you will all the files in that folder



From above command line it is clear that AVG antivirus alters the folder’s view properties.
Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *