[Fixed] The Directory Name Is Invalid in Windows 10 &11

Opening a file but getting the ‘The Directory Name Is Invalid’ error? Don’t worry, this article will offer you a hand to fix the error.


By Lucas / Updated on October 7, 2023

Share this: instagram reddit

The directory is invalid

Whether you're trying to run the software after installing Windows, connect external storage devices, or utilize a DVD drive, the error message 'The directory name is invalid' may appear when opening any files.

4 ways to fix the error [The directory name is invalid]

Many factors like corrupted file system, malfunctioning applications, and defective media such as a USB, SD card, or DVD might trigger this error which impedes you from accessing data on the system or drives, and may cause partition missing or data loss issues.

We've prepared several techniques for you to resolve the issue "The Directory Name Is Invalid" in Windows 10 or 11.

1. Update Disk Driver

Because 'The Directory Name is Invalid' might be triggered by a USB port problem or disk issues, the issue could be with the disk driver. As a result, in this scenario, we propose that you try updating the disk driver and see if that helps.

Step 1. Press the "Windows” + “R" Key. Type “devmgmt.msc” and press "Enter" to open Device Manager.

Step 2. Click "Disk Drives" to show all your disk drives.

Step 3. Right-click on the external drive, USB, or SD card driver and click on "Update Driver".

Drive update

If it’s a USB, you might see the USB Device Properties window. Please click the “Driver” tab, and click the “Update Driver” button. Then click “OK” to exit the “Properties” window.

Update disk driver

2. Check Disk Error

First, you can plug your device into another PC to get rid of the possibility of the damaged device. If it also doesn’t work on that PC, you can try to check the error.

Step 1. Open “This PC”, right-click the drive with this error, go to “Properties”.

Step 2. Click the “Tools” tab and click “Check” & “OK”.

Check & OK

Step 3. Select “Scan drive”. Now, wait for the check process, after that, restart your system to see whether this solution helped you resolve the issue.

Scan drive


It’s also a promising choice to use the CHKDSK command to detect and repair any device corruption to get rid of the "The directory name is invalid" error in Windows 10 & 11.

Step 1. Search “CMD” in the Start search bar, right-click the best match and choose “Run as administrator”.

Step 2. Type “chkdsk d: /f /r” (d: is the drive you want to check, please change the letter to your target drive) and hit “Enter”.


If the device is corrupted or has additional issues, this command may repair them and remove the error.

4. Change a USB port

When Windows 10 displays a 'The directory name is invalid' issue, you may attempt is to re-insert or re-plug the external hard drive, USB, or SD card through a different port. According to several customers, replacing the USB port addressed the problem.

Further tip: Recover data if error [The directory name is invalid] caused data loss

However, some users also find that the error 'The directory name is invalid' results in the loss of all data contained in the target partition and the partition missing problem. If this issue happens, you might only seek some help from a recovery tool.

AOMEI Partition Assistant Professional is a disk and partition problem manager For Windows 11/10/8/8.1/7/XP. The “Partition Recovery Wizard” is the feature that may help you. If you find there’s a missing partition in your PC and you haven’t done anything to overwrite your drive, then it’s possible to get all lost data back.

The operations are user-friendly, you can try the demo at first.

Free DownloadWin 11/10/8.1/8/7/XP
Secure Download

Step 1. Install and run AOMEI Partition Assistant Professional on your Windows PC. Select “Partition Recovery” in the “Recover” menu.

Partition recovery wizard

Step 2. Choose the disk from which you want to recover if the tool detects a lost partition. And then click "Next" to continue.

Choose disk

Step 3. You will get two search modes in the pop-up window:

▶ Fast search: This method will swiftly search the first sector of each partition on the chosen disk to discover the deleted or lost partition.
▶ Full search: This method allows for a more thorough search of every sector of every partition on the specified disk. As a result, extra time is required. When Fast Search fails, you might use it this way.

Choose whichever one you need and click “Next” to go to the next step.

Search methods

Step 4. Once the partitions are found, they will be displayed in the list box, highlight the partition which you want to recover, and click "Proceed" to continue.

Select lost partition

Step 5. After that, the AOMEI Partition Assistant will give you congratulations to notice the partition has been recovered successfully.


After that, you can see these files in “My Computer”.

◤ Note: If the target partition is formatted or is RAW, please turn to a professional data recovery tool.


Hope you can fix the error 'The directory name is invalid' in Windows 10 or Windows 11 with the methods we listed for you.

AOMEI Partition Assistant is a versatile tool, you can also clone a disk, move installed apps to another disk, recover lost data, or convert a disk between MBR and GPT without data damage… And if you’re a Server user, you can try our Server edition to optimize your devices.

Lucas · Staff Editor
I prefer peaceful and quiet life during vacation,but sometimes I watch football match if my favorite club performs brilliantly in that season. And I love reading, painting and calligraphy, thus I send my friends festival handwriting cards every year.