Generally, this issue can be solved by disconnecting and reconnecting the storage device or by connecting it to another USB port. Restarting your system or changing the file directory name may also help solve the issue.
Causes for “The Directory Name is Invalid” Error
The error is a generic error that can occur when the storage device is not recognised or when it becomes corrupt due to logical error or bad sectors. Issues with the system like bad device drivers or wrong application settings can also trigger the error message. Other reasons that can cause this error to appear are as follows
Methods to Fix “The Directory Name is Invalid” Error
To fix the error, firstly make sure if the file you’re trying to access has not been deleted, renamed or relocated. While accessing a particular directory, if the error appears, renaming the said directory can allow you to access the file or the folder again. Checking the USB port of your device to see if there is any physical damage or software problems and then repairing them can also help resolve the issue. If the error is still present after you have tested these simple fixes, you can try the following solutions to mend the error.
Restart Windows Explorer
The first fix for this error is to restart Windows explorer from the task manager. Windows file explorer could be issuing this error when the file explorer fails to recognise or detect the path of the file/folder you’re trying to access. Restarting helps fix the issue by relaunching the service. To do this:After restarting, insert the storage device or try accessing the file again to see if the problem is solved.
Windows Disk Error/CHKDSK Scan
The next fix we’ll try is to perform a disk check scan. This method scans and checks the disk for any errors or bad sectors. If problems are found, the process will then try to fix it. There are two ways to perform a disk scan in Windows devices. Firstly, we’ll try to perform the scan from the file explorer. To do this:Another method to perform the scan is from the command prompt. To do this
Update USB and Disk Drivers
Device drivers are kernel level instructions that establish communication between the hardware and the operating system. If the device drivers become outdated or if they malfunction, this may cause the device to post problems when trying to connect a storage device or trying to access files. Updating the device drivers may help fix this issue. To do this
Change Folder Permissions
This error can also appear if you or an administrator have made changes to the folder permissions on your device. Windows can sometimes post this error if the read and write permissions have been unchecked while trying to access the files in the folder. To fix this
Diskpart for Storage Devices
Disk partitioning is a tool that allows users to virtually divide the storage component inside their device for easy management. This feature can also work with removable storage media. Sometimes, partitioning the storage device from disk management allows users to again access their device and files inside them. Before creating a partition, rescanning the system for connected drives may help find and solve the issue for you. To do this:
SFC/DISM Scan
If the issue still persists, then the next solution would be to perform a System File Checker and a DISM scan. These scans attempt to repair or replace any corrupted system files from a cached copy of Windows in your system. If that fails, the process will try to restore the system files by downloading them. To perform a SFC scan
Change OneDrive Settings
Some users have reported this error occurring when trying to access programs or files from the desktop that have been backed up and saved by Microsoft OneDrive.This happens when you set OneDrive to backup folders and the device is not connected to the internet when trying to access said files. To fix this, you can try connecting your device to the internet and if that is not possible, removing the feature of backing up your device on OneDrive. To do this