Unhiding Renamed File Subdirectories in Windows: A Solution for Hidden Virus Files

Abstract: Restore access to files hidden by malware using the attrib command to remove system and hidden attributes.

Created: 2026-09-07 by
This guide explains how to restore access to files hidden by malware using Windows command-line tools. Many viruses rename folders and set them as system-hidden to prevent detection. By using the attrib command with specific flags, you can strip these attributes and reveal your data without third-party software. This method targets the root cause of the visibility issue rather than just deleting suspicious items.

Understanding the Malware Behavior

When a computer becomes infected with certain types of viruses, particularly those that target removable drives or network shares, the malicious code often alters file attributes. Instead of deleting your documents, images, or videos, the virus renames them with random characters and sets their properties to "Hidden" and "System." In some cases, it creates empty folders with the same names as your original files to deceive users into thinking their data is gone. These dummy folders usually have zero kilobytes in size, while the actual hidden files remain intact but invisible in standard File Explorer views.

This technique is effective for attackers because most users do not know how to change folder options to show hidden items, let alone system-level hidden files. Even when standard hidden files are visible, the "System" attribute often remains checked, keeping the infected folders out of sight. Understanding this behavior is crucial before attempting recovery, as it confirms that your data likely still exists on the drive.

Preparing Your Environment

Before running any commands, it is essential to stop the virus from re-hiding your files. If the malicious process is active, it may immediately revert any changes you make. Therefore, start by disconnecting external drives or USB sticks from the infected machine. Do not open any folders on the drive, as this might trigger the virus to execute its hiding routine.

If you suspect an active infection on your main system drive, consider booting into Safe Mode. This prevents most startup programs and malware services from loading. Once in a clean environment, open the Command Prompt with administrator privileges. Right-click the Start button and select "Terminal (Admin)" or "Command Prompt (Admin)" depending on your Windows version. This elevated access is required to modify system-level file attributes.

Using the Attrib Command

The core tool for this recovery is the attrib utility built into Windows. This command allows you to view and change file attributes such as Read-only, Hidden, System, and Archive. To unhide all files and folders on a specific drive, you need to remove both the Hidden (-h) and System (-s) attributes.

Open the Command Prompt and type the following command, replacing X: with the letter of the affected drive:

attrib -h -s /s /d X:\*.*

Here is what each part of the command does: -h removes the hidden attribute, -s removes the system attribute, /s applies the command to all subdirectories, and /d ensures that directories themselves are also processed. The *.* wildcard selects every file and folder on the drive. Press Enter to execute. The process may take several minutes depending on the number of files present.

Once the command finishes, navigate to the drive in File Explorer. You should now see the original folders and files alongside the dummy zero-kb folders created by the virus. Identify the fake folders by their empty size and delete them. Keep your real files safe.

Verifying File Integrity

After unhiding the files, check if they open correctly. Some viruses may corrupt file headers during the renaming process. If files are inaccessible, you may need additional recovery steps. However, in most cases, simply removing the attributes restores full access. For further protection against similar threats, review our guide on How to Completely Remove a Virus from Your Desktop to ensure no residual malware remains active.

Preventing Future Incidents

To avoid this situation recurring, configure Windows to show protected operating system files only when necessary. Go to File Explorer Options, select the View tab, and uncheck "Hide protected operating system files (Recommended)." Be cautious when doing this, as it exposes critical system files to accidental deletion. Additionally, always scan removable media with updated antivirus software before opening them. If you frequently deal with deleted data issues, learning how to recover lost files is equally important, as detailed in How to Find Deleted Files in Drive C.

Frequently Asked Questions

Why are my files still hidden after running the attrib command?

This usually happens if the virus is actively running and re-applying the attributes. Ensure you have disconnected the drive or booted into Safe Mode to prevent the malware from interfering. Also, verify that you used the correct drive letter in the command.

Can I use this method on a Mac or Linux system?

No, the attrib command is specific to Windows. macOS uses chflags and Linux uses chmod or chattr to manage file permissions and visibility. The syntax and available flags differ significantly between these operating systems.

What if the virus renamed my files with extensions like .exe or .scr?

Malware sometimes disguises itself as executable files to trick users into running it. After unhiding files, check for any unexpected executables in your folders. Rename them back to their original formats (e.g., .docx, .jpg) if possible, or delete them if they are clearly malicious. Always scan the drive again after cleanup.

Is it safe to delete the zero-kb folders?

Yes, these folders are typically created by the virus as decoys. They contain no data and serve only to confuse the user. Deleting them is safe and helps keep your directory structure clean. Just double-check that you are deleting the empty folders and not your actual data.

Will this process delete any of my existing data?

Running the attrib command only changes file attributes; it does not delete or modify file contents. Your data remains intact. However, always maintain regular backups to protect against accidental errors or more severe malware infections that might corrupt files directly.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More