Saturday, July 3, 2010

Path Too Deep (too long file name)

Windows can only handle around 25x characters (including spaces)for files and folders in a path or they can not be deleted or removed. I had a rogue back-up program write files and folders too deep to count. Here is what worked and what did not.

Unlocker programs.
Nix - didn't even try, locking was not the problem.

Renaming all the files and folders to "1" in attempt to get below the limit.
Nix ... I had too many folders deep and renaming stopped working at some level.

RD /S from elevated command.
Nix

Java program claiming abilities.
Nix

Map the folder to virtual drive and work from there.
Unknown because next solution worked.

Here is the winner - very simple. (lost track of who gave it)

If you have Vista or Win7 you're all set to go, or you're on XP then you need to download the Windows Resource Kit Tools installer. Basically you just need to have robocopy.

Make an empty folder say C:\temp

(go to elevated command prompt)
Then use robocopy to copy it to the folder that you can't delete say C:\TooDeep

robocopy C:\temp C:\TooDeep /E /MIR
("TooDeep" is the first folder in the path. Be sure to leave space between /e and /mir)

The /MIR option makes robocopy mirror temp onto TooDeep, or in other words deleting extra files and folders.

1 comment:

Note: Only a member of this blog may post a comment.

Pin Not Available

Crazy Error I had not seen before. Pin not available blah blah. I restarted a few times and it finally worked. If it doesn't some say to...