File Name Too Long Error in Windows 10 – Fix
If you’ve ever seen the issue “File Name Too Long Error”, it was probably a simple fix for you, right? If in case, you guys have seen this error more than twice, then you also know that it can be a complex issue in order to fix it sometimes. Let’s now discuss File Name Too Long Error in Windows 10 – Fix
If you guys are currently struggling with this issue, then we might need help. Below you have a collection of methods that have turned on users in a similar situation in order to resolve the issue. Please follow each and every potential fix in order until you encounter a method that actually fixes the “File Name Too Long” error.
- 1 Why Is Filename Length An Issue In Windows?
- 2 1. The Effortless Fix | file name too long
- 3 2. The Complicated Fixes
- 4 Move, Delete, Or Copy Files Or Directories via PowerShell
- 5 Move Directory via Move-Item
- 6 Delete Directory via Remove-Item | file name too long
- 7 Temporarily rename the file extension to text
- 8 Make Your Windows 10 Home Accept Long File Paths
- 9 Make Your Windows 10 Pro Or Enterprise Accept Long File Paths
- 10 Conclusion
Why Is Filename Length An Issue In Windows?
There is actually a long history of filename lengths being a problem to operate systems such as Windows. There was a time whenever you couldn’t have filenames longer than 8 characters additionally a 3-character file extension. The best that you could do was something such as myresume.doc. This was a restriction in place via the design of the file system actually.
Things got better when the new versions of Windows came out. We went from an old, limited, file system to something that is called the New Technology File System (NTFS). NTFS basically took us to a point where a filename can be 255 characters long. And the file path length could potentially go more than 32,767 characters. So how can we possibly have filenames that are too long actually?
Well, windows have things known as system variables. These are variables that Windows depends upon to function as Windows will always know what the variables mean and where they are. Even when we are moving bits and bytes all over the place actually. The system variable MAX_PATH is the one that basically restricts filenames and file paths to under 260 characters as well.
So, being a variable, you’d think we could change it. No, we should not. It is just like pulling a thread out of a sweater. As soon as one system variable changes, then the other system variables and components dependent on them start to unravel actually.
1. The Effortless Fix | file name too long
If you are fortunate, that you’ll get the error and know exactly what file’s name is causing the issue too. Or at least where you can find the file. Maybe then you have a filename that just looks something like:
It’s obvious that who the offender is in this case. You have to find the file in Windows Explorer or File Explorer as it’s called in Windows 10. Tap once on it, click F2 to rename it, and then change that silly filename to something more reasonable. It’s just as simple as that.
2. The Complicated Fixes
It is not always easy to fix this problem actually. Most of the time you may not be able to change the names of files or directories for whatever the reason is. Well, the following solutions will do the trick for you. They aren’t really hard to do.
Move, Delete, Or Copy Files Or Directories via PowerShell
Most of the time you get an error whenever trying to move, delete, or copy directories where the character count for the file path is up to 260.
Keep in mind that the words directory and also folder are interchangeable actually. We’ll use this ‘directory’ going forward. The following PowerShell cmdlets can also be used on files actually.
Perhaps the file path actually looks something like:
Well, that file path is 280 characters long. So we cannot really copy the directory out of there to somewhere else with the normal copy-paste method actually. We actually get the Destination Path Too Long error as well. Let’s now assume that for whatever reason, we can’t actually rename the directories in which the file is nested. What can we do?
Launch PowerShell. When PowerShell opens, then you will be at the root of your user directory. Now follow along assuming C:\Users\guymc is your user directory actually.
Well, the directory named This is inside the Documents directory as well. If you want to move into the Documents directory, we then use the DOS command cd Documents. You will also see the prompt change to C:\Users\guymc\Documents. That’s pretty good. We are working closer to the directories that will make things easier too.
Copy Directory via Copy-Item
We basically want to copy the directory This and its contents into ThatNewFolder actually. Let’s now use the PowerShell cmdlet Copy-Item along with the parameters -Destination and -Recurse as well.
Destination basically tells PowerShell where we actually want the copy to be. -Recurse tells PowerShell in order to copy all of the items inside to the destination. Copying leaves the originals where they are and also makes all new ones in the destination as well.
Copy-Item This -Destination ThatNewFolder -Recurse
Move Directory via Move-Item
Let’s just say we want to move the directory This, and all of the directories and also files in it, to ThatNewFolder. Moving does not actually leave the original in place. We can also use the PowerShell cmdlet Move-Item along with the parameters -Path and -Destination. -Path actually defines the item that we want to move and -Destination tells PowerShell where we actually want it.
The cmdlet will then put This inside of ThatNewFolder. It will also move each and everything that is inside of the This directory. Move-Item can be used to move files or directories, and it basically works regardless of file path or filename length as well.
Move-Item -Path This -Destination ThatNewFolder
If you want to make sure it worked, then just use the cd ThatNewFolder command in order to get into ThatNewFolder. Then use the dir command to list the directories in ThatNewFolder as well. You will see the This directory is in there too.
Delete Directory via Remove-Item | file name too long
If you want to delete This directory and everything in it, then you can use the Remove-Item cmdlet.
The Remove-Item cmdlet has some built-in safety that basically makes it really difficult in order to delete a directory with things inside of it. Well, in our example, we know we want to delete each and everything, so we’ll use the parameters -Recurse to make it remove everything inside. And then -Force to make it do that without even asking us if we’re sure for each and every item inside.
Remove-Item This -Recurse -Force
Temporarily rename the file extension to text
If you guys are receiving this error whenever trying to move a single .zip or .rar file. Then you can try to temporarily rename the file extension to text and also rename it back after you have moved it as well. Let’s have a look at the quick guide to do this:
- Right-tap on the .zip or .rar archive and then select Rename. Then, modify the extension to “txt“
- Move the file to where you guys want it to be, then right-tap on it again. Select Rename and modify the extension back to what it was initially(.zip or .rar) actually.
If you were not able to move the file along with this method. Or if it was not applicable to your situation, then just move to the method below.
Make Your Windows 10 Home Accept Long File Paths
If you want to make Windows 10 Home accept long file paths, then we need to open the Registry Editor. If you have not worked in Registry Editor before, be cautious actually. Accidentally removing or changing things in here can actually stop Windows from working completely.
Keep in mind that always make a backup of your registry before making any changes. When you have Registry Editor opened, and your backup made, then just navigate to the location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem and also find the key LongPathsEnabled.
Now double-tap on LongPathsEnabled. In the Value data: field, make sure the number 1 is in there too. Tap on OK in order to commit the change. Now exit Registry Editor and you should be able to work along with crazy long file paths now.
Make Your Windows 10 Pro Or Enterprise Accept Long File Paths
If you want to allow Windows 10 Pro or Enterprise to use long file paths. Then we are going to use the Group Policy Editor actually. It’s a tool that permits us to set policies on how Windows operates at the PC and the user levels. We’ve got many articles on via group policy to do things such as turning off or turning on Internet Explorer options, or also adding a message to the login screen actually.
- First, you have to open the Group Policy Editor through going to the Start menu and typing in gpedit. The top result should be the Edit group policy actually. Just double-tap on that.
- When the Group Policy Editor opens, then navigate to Computer Configuration > Administrative Templates > System > Filesystem. Thereyou guys will also see the policy Enable Win32 long paths.
- Double-tap on it to edit the policy setting. Now just change it from Disabled to Enabled, then tap on the OK button in order to commit the change.
Well, the policy may not take effect right away. You can force the group policy in order to update, though.
You are good to go. If you have any queries and issues related to this file name too long” article then let us know in the comments section below.