Source path too long

Source Path Too LongHi,
  I have a weird situation. I have a folder "C:\Data\Invoice\Backup" and in it, I have so  many sub-folders created by ROBOCOPY.
  At first I wanted to simply delete the folder by clicking [Delete] button, but I keep getting this error message about "The source file names are larger than ...".
  I googled this error message and found an article where the author suggested that I rename all these sub-folders to 1 letter length and delete the folders afterwards.
  I followed that suggestion and that is the reason why you see so many 'a'. It was somewhat effective, but no all of the files are being deleted and it is taking too much time to rename folders.
  . When I run a DOS command "DIR /s /w" to list all the sub-folders, I see the following:
 Directory of C:\Data\Invoice\Backup\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\1\1\1\1\1\1\1

Data2000 - 2018 May 7 with blank username_password table.mdb
               4 File(s)     24,697,752 bytes
The directory name C:\Data\Invoice\Backup\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\1\1\1\1\
102011_Honda_pay_online_receipt.asp_files is too long.

     Total Files Listed:
               8 File(s)     98,112,273 bytes
             295 Dir(s)  20,178,972,672 bytes free

Is there any other way to remove this folder from the root (C:\Data\Invoice\Backup\a)?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russ SuterSenior Software DeveloperCommented:
I've encountered this problem before. 7-zip's file manager seems to be able to work around the issue. You can delete the files from within there.
Paul MacDonaldDirector, Information SystemsCommented:
I guess I would move all the files to a sane location, then use DELTREE to delete all those subfolders.
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
or drop to command prompt, and remove manually....

seen this at many Schools..... students do it for a laugh, because explorer cannot handle long paths!
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

sgleeAuthor Commented:
Let me try 7 Zip.
sgleeAuthor Commented:
"or drop to command prompt, and remove manually...." --> how do you do that?
John TsioumprisSoftware & Systems EngineerCommented:
I had this issue some days and Long Path Eraser handled it just fine

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sgleeAuthor Commented:
Is Long Path Erase is free or commercial?
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
sgleeAuthor Commented:
In 7 Zip, I could not delete them.
sgleeAuthor Commented:
DELTREE does not work on Server 2008.
John TsioumprisSoftware & Systems EngineerCommented:
free as a is the direct download link
sgleeAuthor Commented:
LongPathEraser is a killer!
Thank you!
sgleeAuthor Commented:
LongPath - Folder SelectedLongPath - Fails to runI spoke too soon. LongPathErase worked to an extent. It freed up about 30GB of data from the folder. Now every time I open the program, select the folder and click [Delete] button, it fails to run the program.
John TsioumprisSoftware & Systems EngineerCommented:
How about rebooting the machine...
sgleeAuthor Commented:
I restarted the computer and re-ran it. It still crashes. The difference was that it looks longer to crash compare to prior to reboot.
John TsioumprisSoftware & Systems EngineerCommented:
What if you choose some folders there a chance of permissions issue...i see the what if you run LPE as administrator
sgleeAuthor Commented:
I had tried running as "administrator" already.
I also tried to delete a sub-folder towards the end of list of sub-folders.
When I have more time, I will try a different level of sub-folders later.
John TsioumprisSoftware & Systems EngineerCommented:
Well here is another solution...i can't say i have tested it but if nothing helps...then..
In the article besides the solution there is also mention of using a Linux Live CD ...mounting the file system and erasing...i am not 100% sure about that..i can't remember i have done it in the if any member has first hand experience it would be helpful
sgleeAuthor Commented:
Ok. I will give that a shot.
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
drop to a command prompt

change directory to backup

and then type rd . /S
sgleeAuthor Commented:
"rd . /S" did not work. It still complains about "The file name is too long".
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
in that case, you will need to enter each folder, and use  

Open in new window

you may want to check what is causing it in he first place!

which was my fist suggestion!

Should not take too long, and in fact you could have done it by now..... time you've spent in this question!
sgleeAuthor Commented:
Node jsTask Manager@John
(1) I downloaded node-v8.11.1-x64.msi and installed it on the computer.
(2) Restarted the computer.
(3) I ran npm i -g rimraf in command prompt.
C:\Data\Invoice\Backup>npm i -g rimraf
C:\Users\admin\AppData\Roaming\npm\rimraf -> C:\Users\admin\AppData\Roamin
+ rimraf@2.6.2
added 12 packages in 4.719s
(4) Then I ran C:\Data\Invoice\Backup>rimraf a

Since then, the  node.exe RAM usage was on the rise for a while and is fluctuating. CPU utilization fluctuates too.
I will report back when it is done.
sgleeAuthor Commented:
"you may want to check what is causing it in he first place!" --> The wrong use ROBOCOPY /MIR command created this problem. The damage is done and I need to remove these layers of sub-folders to free up space on the hard drive.
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
oh dear!!!!
sgleeAuthor Commented:
Folder B remaining@John
"C:\Data\Invoice\Backup>rimraf a" command is finally executed and it was a success. The folder 'a' is gone and it freed up about 280GB of space.
I started running "rimraf b" and I can already see more free space on the C drive,
sgleeAuthor Commented:
"oh dear!!!!" ---> I said "OMG" when I realized what I did with ROBOCOPY command.
sgleeAuthor Commented:
Finally folder 'b' is also removed and now I have 600GB free space.
Thank you for your help and I appreciate it.
sgleeAuthor Commented:
 I like to re-assign points since the final solution was discovered after my initial point award.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.