0

Trying to get this directory off my computer and can't seem to get it off. Tried creating this bat file to delete them and can't seem to get it correct.

:LoopStart
REN "C:\Users\David\Desktop\*" del
MOVE "C:\Users\David\Desktop\del\ "C:\"
RMDIR /S /Q "C:\Users\David\Desktop\del"

GOTO LoopStart
:LoopEnd

file path that is continuous is this :

C:\Users\David\Desktop\com\example\Lab2-1starter\app\src\main\java
Dikesh Gandhi
  • 447
  • 13
  • 22
  • i tried these and it keeps telling me file path is too long or it doesn't delete. Still have 4,579 folders. Thanks for pointing me in the right direction. Ill keep looking into it. – David Anglin May 06 '16 at 05:34
  • The logic of your script looks wrong to me: you *move* `C:\Users\David\Desktop\del\` do somewhere else, then you try to delete that directory... – aschipfl May 06 '16 at 10:08

1 Answers1

1

Best way to do it easily without any for loops is to use Robocopy

first create a empty directory [say C:\empty] This will be your source directory now, now the idea is to overwrite destination directory .

command to delete the entire content of destination directory :

robocopy c:\empty c:\yourfolder /purge

/PURGE :: delete dest files/dirs that no longer exist in source

Now you can simply run

del /s /q c:\yourfolder

you can use all above command in a bat file to reuse it in a better way.

This will also delete path with long length , make sure you run from admin command prompt.

Pang
  • 9,564
  • 146
  • 81
  • 122
prudviraj
  • 3,634
  • 2
  • 16
  • 22
  • I tried this a couple times today and i stop it after 20 minutes because it just keeps going and going. Gonna let it run all night and see if it works. I will let you know. Thanks again. – David Anglin May 06 '16 at 05:41
  • let it run it will work :) , you can observe the same in logs , and visually as well. – prudviraj May 06 '16 at 07:16
  • This didn't work, i tried it 3 times. After about 30 minutes it says: robocopy stopped responding. – David Anglin May 06 '16 at 12:43
  • I ended up live booting ubuntu from a usb and being able to delete it from there. Thanks for your help. – David Anglin May 07 '16 at 05:19