When you connect your USB storage device (pen drive, memory card, or external hard drive) to an infected computer, sometimes all your files suddenly turn into shortcuts. The original folders appear to be missing, and you may think your data is lost.
This issue is commonly caused by a folder virus (shortcut virus). The good news is that your files are usually not deleted — they are just hidden.
Here is a simple and effective method to remove the folder virus and recover your files.
Important Before You Start
- Do not open or double-click any shortcut files on the infected USB drive.
- Do not delete the shortcut files immediately.
- Use a clean, virus-free computer for the recovery process.
Step 1: Scan the USB Drive with Updated Antivirus
Insert your USB drive into a virus-free computer.
Scan the drive using a trusted and updated antivirus program such as:
- ESET
- Kaspersky
- Norton
- Windows Security (built-in antivirus in Windows 10/11)
This will remove the malicious shortcut virus files from the USB drive.
Some antivirus programs may automatically restore hidden file attributes during the scan. If your files are still hidden after scanning, continue to the next step.
Step 2: Restore Hidden Files Using Command Prompt
If your files are not visible after removing the virus, they are likely hidden.
1. Find the Drive Letter
- Open This PC
- Note the drive letter of your USB drive (for example,
D:orE:)
2. Open Command Prompt as Administrator
- Press Windows key
- Type cmd
- Right-click Command Prompt
- Select Run as administrator
Alternatively, press Windows + R, type cmd, and press Enter.
3. Enter the Drive Letter
In Command Prompt, type your USB drive letter followed by a colon.
Example:
D:
Press Enter.
4. Run the Attribute Command
Now type the following command:
attrib -s -h -r /s /d *.*
Press Enter.
This command will:
- Remove hidden attribute (-h)
- Remove system attribute (-s)
- Remove read-only attribute (-r)
- Apply changes to all files and folders (/s /d)
After the process completes, your original files and folders should appear again.

What Happened?
The folder virus does not usually delete your data. Instead, it:
- Hides the original files
- Creates shortcut files that point to malicious programs
- Spreads infection when shortcuts are opened
By removing the virus and restoring file attributes, your data becomes visible again.
If Files Are Still Missing
If your files do not reappear:
- Check if they were deleted permanently
- Use a reliable data recovery software to scan the USB drive
- Avoid writing new data to the USB drive before recovery
How to Prevent Folder Virus in Future
- Always scan USB drives before opening them
- Disable AutoRun/AutoPlay on Windows
- Keep your antivirus software updated
- Avoid using USB drives on unknown or public computers
Folder virus infections can make it look like your USB files are lost, but in most cases, the files are only hidden. By scanning the drive with a trusted antivirus program and restoring file attributes using Command Prompt, you can recover your data quickly and safely.
Always ensure you use a clean system during recovery and keep your devices protected to avoid future infections.



