After booting up your computer and attempting to open one of your folders, you’re met with a Windows prompt that says “the directory name is invalid”. Any further attempts at accessing your folder are met with the same repeated error message.
This error can occur for many reasons. Sometimes it’s as simple as incorrect permissions, other times it could be a result of bad sectors on your drive. Either way, this article will provide an understanding of what causes this problem and how you can fix it.
Common Causes of “The Directory Name Is Invalid” Error
This error occurs when, for some reason, Windows unsuccessfully attempts to access a directory. It could be triggered by you manually, or by Windows trying to run a program in the background. It can also happen when your USB flash drive isn’t recognized and Windows tries to access it. Listed below are some common reasons why this can happen to you.
|📥 Improper device removal||Removing your device without safely ejecting it first can interrupt delicate write processes, resulting in incomplete transfers that can corrupt your data or file system.|
|🗯 Malware attack||A virus could have infected your drive, potentially corrupting your file system and preventing Windows from accessing certain parts of your drive.|
|📂 Incorrect permissions||If you do not have the correct permissions to access the folder or device, Windows may return this error message as an indicator.|
|💿 Bad sectors on the drive||Windows is unable to detect bad sectors by default, so it’s possible that it’s trying to access a location that is no longer accessible.|
If Windows is saying the directory name is invalid, you should first look at recovering your data before applying any fixes to ensure none of your files are lost in the process.
How to Recover Files When the Directory Name Is Invalid
If your drive says the directory name is invalid on your Windows 10 computer, recovering the data is still possible as long as the drive is recognized by the Device Manager. Although you may not be able to retrieve your data using Windows Explorer, you can use specialized data recovery software to find and recover the data for you.
Disk Drill is a data recovery tool that we use often because of its reliability and speed. Follow these steps to recover any files on a drive that’s saying the directory name is invalid.
How to Fix “The Directory Name Is Invalid” Issue
Once you’re finished with file recovery, you can safely move on to diagnosing and fixing your drive so the error message no longer appears. Work through each method to ensure you don’t miss any important troubleshooting steps.
Try Another Port
If Windows says the directory name is invalid when your USB, SD card, or external hard drive is connected, it may be caused by the USB port you’re connecting to. If the USB port is faulty, it can act erratically when devices are connected and break down communication between the device and your operating system.
Try connecting to another USB port. If successful, you can diagnose the original USB port to resolve the issue.
Fix Using CheckDisk
CheckDisk is a utility included with Windows that specializes in finding and resolving issues relating to your drive’s file system. If, say, your drive has some bad sectors, CheckDisk will be able to identify them and mark them so Windows knows not to save new data to that space.
Running CheckDisk may fix the issue that’s triggering Windows to say that the directory name is invalid when opening a file. Follow these steps to do so.
If your drive is NTFS-formatted and you do not have the correct permissions to view the file or folder, Windows may reject your attempt by saying the directory name isn’t valid. Permissions are used to secure your data and protect them from other users accessing it, especially on shared computers.
Follow these steps to check the permissions of a folder and update them if necessary.
Check for Viruses
Viruses can do a multitude of malicious things to your drive. This includes the ability to delete directories or tamper with them in a way that prevents Windows from reading them. Thankfully, recovering deleted files is possible. But, if your computer has been infected by a virus, you may need to remove it first to resolve the Windows message that states the directory name is not valid.
You can scan your computer with any antivirus software, but these steps will guide you through performing a scan using Windows Security.
Boot Into Safe Mode
When you boot into safe mode, Windows only loads the files that are necessary for your computer to function. Anything extra will not be loaded on boot to prevent it from interfering with Windows. This gives you the opportunity to diagnose the problem, like uninstalling suspicious software and running repair utilities.
Once you’re in safe mode, see if the message still appears. If it doesn’t, this means it could be in relation to an application on your computer. Now that you’re aware, you can restart your computer like normal and look through your installed applications to see if there are any that could be causing this.
If you connect your external hard drive and it says the directory name is invalid, the first thing you should do is try connecting it to another USB port (preferably a back panel one on desktops as it connects directly to the motherboard).
If that doesn’t work, you can see if it’s an issue with the file system by checking the drive for errors using the building error checking function (that utilizes CheckDisk) in Windows.
- Open Windows File Explorer.
- Right-click the drive, then select Properties.
- Click Tools.
- Under Error checking, click Check.
- Click Scan drive.
This means the file has either been renamed, moved, or deleted. Microsoft Word will display this message when it is unable to locate the file you’re trying to open. Try using Windows Explorer to search for the file manually, either by keyword or file extension.
If your external hard drive, SD card, or USB directory name is invalid, it could be a problem with the file system. Use CheckDisk to scan for and fix any file system related issues with the external hard drive by following these steps:
- Right-click Start. Select Windows PowerShell (Admin).
- Type chkdsk D: /f /r. (Replace D: with your own drive letter). Press Enter.
If you’re trying to run something in a task scheduler but it returns the error code 0x8007010B, it’s very likely being caused by the use of quotation marks for the specified location. Removing the quotation marks surrounding the directory path should resolve the issue.