Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a very, very deep tree of subdirectories on windows?

I was testing a file management program today and while looking to solve something else my program ended up not checking for moving a directory to the same directory.

The result is a possibly endless recursion of dir1s. I need to commit the changes so I'm desperate to get these out of my repository.

Any ideas?

Basically.. what I got is:

dir/dir/dir/dir........./dir/dir/dir It's probably on the thousands.

like image 655
elite5472 Avatar asked Dec 10 '11 22:12

elite5472


3 Answers

Are you just trying to delete the directory and all subdirectories? RMDIR /S /Q [dirname] from a command prompt should do the trick.

Update Try this as a workaround:

  1. At the top level of the problem directory, create another directory called 'dummy_dir'

  2. Run robocopy dummy_dir problem_dir /purge

like image 64
JohnD Avatar answered Nov 08 '22 11:11

JohnD


Install Git Bash or some other form of linux shell emulator. Works perfectly without any hassle.

rm -rf /c/offending/dir

like image 22
Scott Avatar answered Nov 08 '22 12:11

Scott


Thanks to Meghraj Choudhary for the script to delete the files on windows. https://github.com/dev-mraj/fdel

He claims it shortens the path and thus help to delete them Helpful for node developers

npm install fdel -g
fdel ./node_modules
like image 1
Salil Kothadia Avatar answered Nov 08 '22 11:11

Salil Kothadia