How to Recover Files Deleted or Corrupted by Viruses in your USB Drive or Memory Card

USB drives and Memory cards are now more commonly used storage for our important files like photos, videos, and other documents because of portability. 

But by the increasing number of users, viruses are also easily spreading through these devices, and the worst thing to happen is when your precious files got infected and deleted or are not usable anymore. And when you scan it with your anti-virus program the files are all gone. In this article i will show you how to recover those files.

No need to install any 3rd party softwares or hire any expert, you only need a windows PC and basic computer knowledge to do this.

So here's my step by step guide for you on how to recover corrupted files in your USB Flash Drive or Memory card using CMD or command prompt of windows:

Note: This trick may not work in all cases, and this will only work if your files are corrupted by virus not by manual deletion or formatting.

1. Plug your USB or MMC in a clean PC with an anti-virus program installed for higher chances of success. 

2. For Windows 7 users:

Open Computer and open your USB drive folder.

Press shift then right click on the blank space inside your USB main folder. Click on "open command window here". A command window should appear, now go to step 3.
2. For Windows XP users:

Press Windows Key + R in your keyboard, type cmd then press enter. type cd D:\  (note: change the letter D:\ with the drive letter of your USB Drive or Memory Card).

press enter, then proceed to step 3.

3. Copy this line of code and paste it in the command window:

attrib -s -r -h *.* /d /s

now press enter on your keyboard, and that's it!. Wait for your files to show up, large memory could be longer to process.

You files and folders should appear now, if there's a folder named _ open it and you will find more files inside it.

What the virus actually does is it hides your original files and make fake copies that when clicked spreads the infection, these fake copies are the ones detected by anti-virus and deleted. This trick will show all the hidden original files.

Again, this may not work on all cases and this trick of file recovery is only for files corrupted by viruses and not those deleted manually or by formatting, and you can post your questions in the comment box below.

Did you like this post? Kindly Share:

About Author
I'm Alison Alimambo, owner and manager of this blog, an online entrepreneur, blogger, graphic artist, and software developer. Connect with me on Google+ and Facebook. more

The design and all the contents of this site are copyrighted and licensed to me. Except for product images, logo and registered names which belong to their rightful owners., If you want to republish it in any website or blog please give proper credits to the original author.


  1. Thanks for this informative blog as it provide so much of information, the USB can be avoided by data loss just by different ways as gaurav told in the reply apart you can also use restoring points, backups and if not then you can recover USB drive just by using software which must be last option.


  2. attrib -s -h /s /d *.* command makes all the folders including system related folders to appear. which is bit messy, by using dir/ah command we can easily identify the Virus effected directories easily.

    This command helps to unhide the hidden folder which are greatly effected by virus in Flash Drives .

    1. attrib -s -h /s /d *.* command won't make all system folders appear ..did you read the whole instruction ? will enter the usb drive by using the cd command so only the files and folders on that drive will be shown just commented to put a link to your blog isn't it ? ..thanks btw

  3. Why is it ctrl+r won't work on our pc? I've already clicked it for several times? Thanks!

  4. I kept on clicking the ctrl + r but it is not working. What should I do?

  5. What if Microsoft Windows XP [Version 5.1.2600]? Is this procedures will still work? Thanks!

  6. What if we have Microsoft Windows XP [Version 5.1.2600]? Is this procedures will still work? Thanks!

  7. Thank You so much!!

    As I thought its only a virus that hides my files.

  8. i followed ur instructions & it said

    "the system cannot find the drive specified"


  10. Thank you sooooooooooooo much!
    Really touched when I see my dear folders all back!
    God bless!

  11. The.... attrib -s -h /s /d *.* did not work for me but the...
    for /f %F in ('dir /a:hs /b') do attrib -h -s %F
    it works.

  12. it didnt work, my usb is e: how?

  13. When i do it , it says access denied and nothing is restored :(

  14. it says "Device is not ready "

  15. wow thank you soo much.. i thought i will never get the chance to recover my niece's files from the flash drive i borrowed from her.. i bet she's gonna cry if i wasnt.. this was a big help.. mwuahh love you. haha

  16. thank you very much!!! you've been a great help ^___^

  17. Command prompt not staying open

  18. What to do when you plug in your pendrive in to the computer and prompts you to format it first before you can use it again?

  19. can I recover a video files that have been infected by virus which it turn the video files to a picture format?

  20. great trickkkkkkkkk
    u resolve my problem


Official Fan Page

Add me on Google+