How to Recover Virus Infected Files from an External Hard Drive

You plug in your external drive and your files are missing or have turned into shortcuts. You can often recover virus infected files from an external hard drive, because most viruses only hide your files and do not delete them. This article shows you how to scan the drive for threats, unhide your files and check for a backup. If your files are truly deleted, you also get recovery options to try. Results depend on whether new data has overwritten the old files, so stop using the drive until you finish.

How to Use the Table of Contents

The table of contents lists every method in this guide, from easy to hard. Use it to find the right section fast.

  1. Read the When it works line of each method to see if it matches your problem.
  2. Select a title in the list to jump straight to that section.
  3. Start with Method 1 and move down the list. Stop when your files are back.
  4. Use the comparison table and the tips at the end for a quick review.

Method 1: Scan the Drive with Windows Security (Free)

When it works: A virus is still on the drive and you want it gone before you copy anything. This step removes the virus. It does not bring back deleted files.

  1. Plug in the external hard drive.
  2. Open Windows Security from the Start menu.
  3. Select Virus & threat protection.
  4. Under Current threats, select Scan options.
  5. Choose Custom scan and select Scan now.
  6. Select your external drive letter and start the scan.
  7. Follow the on screen prompts to remove any threat it finds.
Screenshot placeholder
Custom scan option in Windows Security
Tip: If the virus keeps coming back, run a Microsoft Defender Offline scan. Open Scan options, select Microsoft Defender Antivirus (offline scan) and select Scan now. Your PC restarts and scans before Windows loads.
Note: Windows Security can quarantine an infected file. Open Protection history to see what it handled.

Method 2: Show Hidden Files in File Explorer (Free)

When it works: The drive shows less data than before, but the used space is still high. Many viruses only hide your files.

  1. Open File Explorer and open your external drive.
  2. On Windows 11, select View > Show > Hidden items.
  3. On Windows 10, open the View tab and tick Hidden items.
  4. Look for faded files and folders. These are your hidden files.
  5. Copy them to a folder on a different drive.
Screenshot placeholder
Hidden items option in the File Explorer View menu
Warning: Do not open shortcut files (.lnk) that appeared after the infection. Some viruses use shortcuts to run again. If your real files do not show up, go to Method 3.

Method 3: Unhide Files with the attrib Command (Free)

When it works: Files stay invisible even after Method 2. The attrib command removes the Hidden, System and Read only marks a virus can set.

  1. Press the Windows key and type cmd.
  2. Right click Command Prompt and select Run as administrator.
  3. Type the command below. Replace E with the letter of your external drive.
  4. Press Enter and wait until the cursor returns.
  5. Open the drive in File Explorer and check your files.
attrib -h -r -s /s /d E:\*.*

What the command means: -h clears Hidden. -r clears Read only. -s clears System. /s includes subfolders. /d includes folders themselves. Microsoft explains each option in the attrib command reference.

Screenshot placeholder
attrib command in Command Prompt
Warning: Use your external drive letter only. Do not run this command on your C drive. It would unhide files that Windows hides on purpose.

Method 4: Restore Files from a Backup or Another Copy (Free)

When it works: You saved the files somewhere else before the infection. Windows File History only helps if it was turned on before the loss.

  1. Open Control Panel and search for File History.
  2. Select Restore your personal files.
  3. Browse to the folder that held your file.
  4. Select the file and then select the green Restore button.
  5. Check OneDrive, another PC, your phone and old email attachments for copies.
Screenshot placeholder
Restore button in File History
Note: File History saves folders from your PC. It may not have a copy of files that lived only on the external drive.

Method 5: Recover Deleted Files with Windows File Recovery (Free)

When it works: Files are deleted or the drive was formatted, and Methods 2 and 3 found nothing. Windows File Recovery is a Microsoft command line app for Windows 11 and Windows 10. It works on external drives and USB drives. Results depend on the drive and its file system (NTFS, FAT or exFAT).

  1. Open the Microsoft Store, search for Windows File Recovery and select Get.
  2. Open Windows File Recovery from the Start menu and select Yes on the prompt.
  3. Type the command below. Replace E with your infected drive and D with a different drive that has free space.
  4. Press Y when it asks you to continue.
  5. Wait for the scan. Press Ctrl + C to stop it.
  6. Open the Recovery_(date and time) folder on the D drive.
winfr E: D: /extensive /n *.docx /n *.jpg

What the command means: winfr starts the tool. E: is where the files were lost. D: is where recovered copies go. /extensive runs a deep scan. /n *.docx looks for Word files and /n *.jpg looks for photos.

Screenshot placeholder
winfr command running in Windows File Recovery
Tip: Use /regular for a recently deleted file on an NTFS drive. Use /extensive for FAT and exFAT drives, for formatted drives and for older deletions. Microsoft lists the full table in its Windows File Recovery guide.
Warning: The source and destination must be different drives. Recovery can take a long time. Files that new data has overwritten cannot come back.

Method 6: Use Recovery Software (Last Option)

When it works: Windows File Recovery found nothing or you prefer an app with buttons. This option is useful when files are deleted, the drive was formatted or the file list is damaged.

Recommended tool: Hard Drive Recovery Wizard. Read the official product page first. The tool runs on Windows and works with NTFS, FAT and exFAT drives. The free demo lets you preview recovered files before you buy the full version.

  1. Download Hard Drive Recovery Wizard and install it on your PC, not on the infected drive.
  2. Plug in the external drive and select it on the home screen.
  3. Select the scan mode and start the scan.
  4. Preview the files and use the filter to find the ones you need.
  5. Select Save and choose a folder on a different drive.
Screenshot placeholder
Recovered files preview in the recovery software
Note: No software can bring back data that new files have overwritten. For more options, read our guides on recovering deleted files from a hard disk partition and the best software to recover deleted files from a hard drive.

Comparison Table

MethodWorks WhenEasy or Hard
1. Windows Security scanA virus is still on the driveEasy
2. Show hidden filesFiles look missing but used space is highEasy
3. attrib commandFiles stay hidden after Method 2Medium
4. Backup or another copyYou saved the files somewhere elseEasy
5. Windows File RecoveryFiles are deleted or the drive was formattedHard
6. Recovery softwareWindows File Recovery found nothingMedium

Start at Method 1 and move down the table. The first four methods do not overwrite your deleted files, so try them first.

Tips to Avoid Losing Files in the Future

FAQs

1. Can a virus delete files from an external hard drive?

Yes. Some viruses delete or corrupt files. Many only hide them, so check for hidden files first.

2. Why do my files show as shortcuts on the external drive?

A shortcut virus hides the real files and creates shortcut (.lnk) files in their place. Scan the drive and then use Method 2 or Method 3 to unhide the originals.

3. Is the attrib command safe to use?

Yes, when you use your external drive letter. It only clears the Hidden, Read only and System marks. It does not delete anything.

4. Should I format the drive to remove the virus?

No. Formatting erases the file list and lowers your chance of recovery. Scan the drive and copy your files out first.

5. Can I recover files if I already saved new data on the drive?

Sometimes. New data can overwrite the old files and those files cannot come back. Stop using the drive and try the methods above as soon as you can.

Conclusion

A virus does not always destroy your files. Scan the drive first and then try the simple steps of showing hidden files and the attrib command. If files are deleted, check your backups and try Windows File Recovery or recovery software. No method can promise a full recovery, and results depend on how much new data the drive received. Keep a second copy of important files from now on.