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.