The name you specified is not valid or too long
I recently did some data recovery for someone who “accidentally” re-installed Windows 7.
I managed to recover about 80% of the data.
But the data recovery program that I used got caught in a loop, so some recovered folders ended up about 30 or 40 sub-folders deep
This type of scenario often shows what shortcuts Microsoft take when designing their OS…
In this case, I was using Windows XP.
When I tried to copy a whole recovered folder tree, I would get the error:
The name you specified is not valid or too long
It was soon obvious that XP has a short internal buffer for storing a folder path.
The filesystem (NTFS) could easily create virtually unlimited folder depths, but windows explorer (and possibly the underlying OS itself, could not cope with something like:
C:recoveryDocuments and SettingsuserAppdataRoamingMicrosoftWindowsLibrariesOfficeOutlookLocalTemporary Internet FilesIE5.6WindowsMicrosoftAppdataOfficeOutlookLocalIE1.2Temporary Internet FileswindowsuserAppDataMicrosoftRoaming..
Anyway, you get the message.
Since I couldn’t copy these files and folders, I should just delete them, right?
But deleting them gave the error: The name you specified is not valid or too long.
So what do I do now?
I had a hunch that the buffer was just used to store the full path name (ie the long string of folders above), so if I renamed the folders to a shorter name, it might fit into the XP buffer, and I can finally delete them.
It turns out I was right.
I had about 50 folder paths to rename, but I eventually got them all to be shorter. Using the above as an example, I just renamed each folder using the first character in its name ie:
c:rduarmwlooltiwmaoolitwuamr
Sure, it looks crazy, but the overall length means I could finally delete the offending files and folders.
I’m sure that if I looked hard enough, I would have found a windows explorer equivalent that didn’t have the same restrictions… but given the time constraints, it was just easier to just spend 30 minutes renaming the folders (its really fast if you use keyboard shortcuts like: F2=rename folder, and arrow keys, spacebar, enter key, all at the correct time.
I have also found that this often prevents me from placing an “Old Data” folder on a customers new PC. The addition of [usersusernamedesktopold data] often times puts the character length over the edge. I remember there being an explicit 256 character path limit in older versions of MS Windows. I would have hoped that improved with 7, but I don’t think so.
Also, I had a very challenging mess when moving a customer’s MS-Access databases from their old server to their new server for similar reasons. There were folders with names like ‘don’t ever move anything from this folder or things will break’. Path names were so long that I had to rename them to shorten them, but then had to rename them back once on the new server so that linked data tables could find each other again :/ .
Of course the person who created this mess was no longer with the company, and nobody wanted to go through the trouble of changing things.