A way of recovering from "The path is too long"

User avatar
John Gray
PlatinumLounger
Posts: 5412
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

A way of recovering from "The path is too long"

Post by John Gray »

I'd taken a copy of my Windows 7 C: drive onto another disk, but somehow after three or four levels the Application Data directory had repeated itself an enormous number of times (with files at some levels) and was entirely undeletable by all the methods known to me, viz:
  • Windows Explorer delete
  • RD <toplevel> /q /s
  • RD \\?\E:\<toplevel> /q /s
  • Unlocker
  • Safe Mode with all the above
Fortunately I came across a sneaky Robocopy method:
Create an empty directory E:\MT (ho-ho!), and Mirror it to the undeletable directory structure, using something like

Code: Select all

ROBOCOPY E:\MT E:\<toplevel> /MIR /E /R:0 /W:0 > E:\$log.txt

It did an awful lot of work but the job was done in a few minutes, leaving the now heavily-truncated undeletable directory structure to be trivially deleted!
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: A way of recovering from "The path is too long"

Post by HansV »

Thanks for the tip!
Best wishes,
Hans

User avatar
BobArch2
BronzeLounger
Posts: 1242
Joined: 25 Jan 2010, 22:25
Location: Pickering, Ontario, Canada

Re: A way of recovering from "The path is too long"

Post by BobArch2 »

John Gray wrote:I'd taken a copy of my Windows 7 C: drive onto another disk...
Thanks for the tip John. Now, where were you several months ago when I had a similar problem? My solution was to format the da.. hard drive. That showed them! :hairout:
Regards,
Bob

User avatar
John Gray
PlatinumLounger
Posts: 5412
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: A way of recovering from "The path is too long"

Post by John Gray »

You won't know how close I was to doing that! And I'd also done a full CHKDSK!
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: A way of recovering from "The path is too long"

Post by ChrisGreaves »

John Gray wrote:Application Data directory had repeated itself an enormous number of times
John, where were you when I needed you two days ago? (mutter mutter!)
I had this problem with my Win7 installation and assumed it was something I'd done as a newbie to Win7.
The manifestation was a RoboCopy backup that filled my external drive after running for about 6 hours!
My novice solution was to rebuild the hard disk from the recovery partition, reinstall Win7, Mozilla, Office et al.

To learn that RoboCopy is a solution to the problem manifest (but not caused) by RoboCopy makes this my Aaaargh! moment of the day (grin!)
He who plants a seed, plants life.

User avatar
John Gray
PlatinumLounger
Posts: 5412
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: A way of recovering from "The path is too long"

Post by John Gray »

There is a good series of posts from Microsoft Social Answers which explains that this problem with repeated instances of "Application Data" is probably as a result of changing permissions without realising the drastic effect that this can have.

For Robocopy use, the magic switch is /XJ - eXclude Junction points, until such time as you can revert the permissions to what they were originally (good luck to us all!)...
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: A way of recovering from "The path is too long"

Post by ChrisGreaves »

John Gray wrote:Microsoft Social Answers
Has anyone (yet) tried the recommendations for setting in the first answer ("Friday, August 27, 2010 1:15 AM")?
If not, I might have to be the guinea pig.
For Robocopy use, the magic switch is /XJ
Works fine.
Thanks John for passing on this interim workaround.
He who plants a seed, plants life.

User avatar
John Gray
PlatinumLounger
Posts: 5412
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: A way of recovering from "The path is too long"

Post by John Gray »

I've tried resetting the permissions, but as always with permissions there's always Something that seems to prevent you doing what you wanted. I've not really had a chance yet to demonstrate whether the changes work or not. So go ahead!

What I'd really like is a "change all permissions to the installation default" program!
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: A way of recovering from "The path is too long"

Post by ChrisGreaves »

John Gray wrote:What I'd really like is a "change all permissions to the installation default" program!
Ahhah!
For once I know the answer to this one.
It's called "Recovery Partition"! :flee:

I reset my permissions on the notebook last night, following the instructions in the head of that thread, but had rather less success on the netbook.
I will try again this evening.
He who plants a seed, plants life.