6 Way To Fix “The Directory Name Is Invalid” Error

You often receive “The directory name is invalid.” error while trying to access the files or folders stored in your USB drive, SD card, external or internal drive, CD/DVD drive etc. This error can takes place due to numerous reason like –   entering the incorrect path or files/folder name, corrupted file system damage USB port & more. However, it’s quite easy to deal with this error.

In this post, I have suggest you some of the most effective ways on how to fix “the directory name is invalid USB“. So, if you want to get rid of this problem then go through them carefully.

Rated Excellent on Trustpilot
Free USB Drive Data Recovery Tool.
Recover data from USB drives, Pen drives, SSDs, HDDs, and other devices on Windows. Try now!

The directory name is invalid error

It seems this error can happen anytime anywhere and can be caused due to various reasons. Here are some of the common causes –

  • Typing in incorrect or invalid file/folder name in ‘Run‘ program.
  • Outdated drivers.
  • Faulty or damaged file system.
  • Bad sectors on the drive and so on.

How to Fix “The directory name is invalid.” Error?

Watch this video guide to fix the “The directory name is invalid.” error in USB.

Basic Troubleshooting Fixes

Let’s start troubleshooting this “the directory name is invalid” error with the basic troubleshooting fixes:

#1: Disconnect & Again Connect The USB

The very first method you can try to outcome from this issue is to reconnect the USB drive. In most of the cases, it has been found that the external hard drive issues are resolved by simply disconnecting and re-connecting the drive to the PC.

So, all you need to do is to disconnect your USB flash drive from the computer and then connect it after some time.

Once, you have done so, check if the issue is fixed or not. If not, move on to the next method.

#2: Use Different USB Port

The foremost reason behind the occurrence of “USB error the directory name is invalid” is the corrupted or damaged USB Port that you’re trying to attach to your USB.

If your USB Port is corrupted due to any of the reasons like malware attack, moisture, dust, etc. then it’s possible to encounter “USB device is not reorganized”, USB device malfunction, including the directory name is invalid error.

However, to troubleshoot such a problem, you have to plug the USB device into a different USB port of the system.

#3: Check The Path/File Or Folder Name

As I have already mentioned above, sometimes entering the wrong/incorrect path, file or folder name can often cause “the directory name is invalid USB” error. So, you must check them twice before taking any step.

If the error is not solved with the basic solutions then move ahead & try out the other effective ways to fic this error:

#1: Run The CHKDSK Command

As we all know, CHKDSK is the Windows inbuilt utility that has enough capability to check for the integrity of the hard drives or file system errors and fix them effectively.

Hence, all you need to do is to connect your USB/SD card to a PC and run chkdsk on your Windows PC. Doing so will fix the drive corruption issue and will help you to access data stored within it.

Here are the easy steps to run chkdsk:

Step 1: First, press on the Win + R keys at the same time to open a Run window.

Step 2: In a search box, type the cmd >> press Enter.


Step 3: Then, copy & paste the command line- chkdsk e: /r /f. (Here, replace the ‘e’ with your drive letter)

chkdsk E: /f

Step 4: Next, hit the Enter for initiating the process

Step 5: Now, the CHKDSK will thoroughly scan your hard disk for any corruption and fix it.

Step 6: After fixing the drive corruption, check if you are able to access the USB data without any error.

Also Read: Fix “USB Device Over Current Status Detected” Error

#2: Update The Disk Driver

Sometimes, the corrupted or outdated drivers can lead to the directory name is invalid or other hard drive-related issues. In such a case, updating outdated drivers or installing correct drivers can help you to troubleshoot this error as mentioned here.

Therefore, here also need to do the same thing by following the beneath steps:

  • On your desktop, you need to press a “Win + R” keys together.
  • After this, type the devmgmt.msc >> hit the “Enter” in order to launch a device manager.


  • Then, expand the “Disk Drives“.
  • Make a right-tap on a USB drive, SD card or external hard drive >> tap on “Update the Driver Software“.

Update Driver Software

After finishing these steps, now you can attempt to access the Disk again.

#3: Fix The Directory Name Is Invalid USB Drive By Running Check Disk Utility

Another effective way that you ought to try is to run the Windows error-checking utility. This tool will deeply scan your USB drive for errors and repair them.

Follow the below step-by-step method to run error checking on your Windows computer:

Step 1: At first, you need to press the Windows + E keys to open the File Explorer >> tap on This PC.

Step 2: In the second step, select the corrupted or faulty drive, make a right-tap on it & choose Properties

Step 3: After this, go to a Tools tab >> click on the Check.


Step 4: Tap on a Scan Drive option.

error checking tool

Once the above steps are done, just restart your PC & use your hard drive without any problem.

#4: Uninstall The USB Controller Driver

Most of time, it happens that due to the corrupt USB controller driver you can receive numerous USB related-issues like USB no media error, not accessible USB drive, and many more including the directory name is invalid USB drive.

In such a situation, uninstalling a USB controller driver can help you to deal with this error. Here is how you can do so:

  • First of all, go to the Device Manager>> open the Universal Serial Bus Controllers
  • Choose the corrupted Universal Serial Bus Controllers
  • Make right-tap on it >> click on the Uninstall device option.

Universal Serial Bus Controllers1

  • When this process is over, reboot your PC & check if an issue is resolved.

#5: Perform Clean Boot On Your PC

You may also perform clean boot on your PC in order to find the problematic apps or programs that might causing this error. After doing so, you may uninstall them by following the below given steps:

  • Launch a RUN dialog box by pressing Win + R keys then type MSConfig in the search box.
  • After that, navigate to Services tab then tick the checkbox Hide all Microsoft Services & click on Disable All.

Hide all Microsoft Services

  • Now, go to the Startup tab then click on Open Task Manager.

Open Task Manager

  • Here, you need to choose the items that might causing this error & click on Disable.
  • That’s it, now you can exit the Task Manager then click the OK button on a Startup
  • Once done! Restart your system in a clean boot environment.
  • Follow the on-screen instructions and try to uninstall the problem causing apps or programs.

#6: Disable The DVD Drive

Sometimes, you may receive “the directory name is invalid” error while try to play your DVD disc on PC. So here you can simply fix this issue by disabling the DVD drive.

  • Right click on the Windows icon then choose Device Manager.
  • After that, expand the DVD/CD-ROM drives then right-click on your drive & select the option Disable Device.

Disable The DVD Drive

  • Now, you will be prompted to confirm your action, click Yes to disable your DVD drive.

Once done, find your drive and re-enable it again and you are done!

How To Recover Data From Invalid USB Drive?

While fixing or after resolving a USB error the directory name is invalid, if you find that all your crucial files have been deleted from it then stop worrying anymore. This is because by using the versatile USB Drive Data Recovery Tool, you can easily recover data from a USB drive.

Not only from USB, but it has the capability to retrieve stuff from other external drives as well like SD/microSD cards, pen drives,  hard drives, etc. without any backup.

The best thing about this utility is that- it supports both the OS: Windows as well as Mac systems. So, just download this program on your PC and run it.

emidTry Photo Recovery For Windows emidTry Photo Recovery For Mac
* Free version of the program only scans and previews recoverable items.

Here is the step-by-step guide that you need to follow to recover data from a dead USB drive.

Frequently Asked Questions:

How Do I Fix the Directory Name Is Invalid in Command Prompt?

In order to fix the directory name is invalid in Command Prompt, follow the below steps carefully:

  • Go to Start, then point to All Programs >> click on the Accessories.
  • After this, right-click on the Command Prompt or Notepad >> click Properties.
  • In a Start in the box, you have to change a value from the %HOMEDRIVE%%HOMEPATH% to the system-wide value like %WINDIR%.
  • Finally, click on OK option.

What Is a Directory on a USB?

The directory on a USB drive is a section that contains the backup images, feature keys, configuration files, certificates, & diagnostics information.

How Do I Change the Name of My USB Directory?

If you want to change the name of your USB directory, follow the below steps:

  • Connect your USB flash drive to PC.
  • Then, choose the drive which represents a USB drive & then right-click on it.
  • Here you will get the menu list, simply find & select Rename option. Now, you can provide a new USB directory name as per your choice.

Also Read: Fix Error Checking USB Drive Scanning and Repairing Stuck


Here, we have specified the major factors along with the corresponding approaches to fix “the directory name is invalid” USB error. Though, you can try the aforesaid solutions according to your situation and need.

However, in case of any data loss scenario, you can also try the recommended USB Drive Data Recovery Tool to get back your deleted USB data.

Last but not the least, if you liked this article then please share it with your family, friends, and relatives.

Thank you…!