Deleting files with names that are too long
- Posted On: October 12th, 2010
- Filed Under: Random Stuff
- Tagged As:
While moving some backups around on my computer and external HD I ran into an issue with a series of old files. It didn't matter whether I was moving them, copying them or deleting them I always got the same error:
"The file name you specified is not valid or too long. Specify a different file name.
My first thought was to hit the command prompt and delete them from there - no luck.
After hitting Google I discovered a relatively brilliant solution. Essentially, somehow, the file structure got too big for Windows to handle so the trick is to shrink the file structure. As Mark Wilson points out you can just rename parent directories to single character names. Do this through a few levels and eventually you'll unlock access to the file.
As the file was a backup of a backup of a backup I'm not sure how it ultimately ended up with such a long filename but the solution is elegant enough.