DiREKT (Directory REKT)
So, I was running my computer doing stuff and one misbehaving Java application (Android studio actually) ruined my damn filesystem by creating a SEEMINGLY infinite number of directories.
So, Windows would say "Oh, I can't quite delete this crap because my path character limit doesn't allow it"
Linux would say "Dang this is hard, and after some time, after making mount.ntfs eat a whole lotta CPU time, it died :(
I made some application in C++ using Linux C API, same result as above
It was seemingly due that since Java made this mess, Java will solve (OR ELSE >:()
So basically I did a directory removing utility, it wipes your directory of choice (PLEASE DOUBLE CHECK WHAT YOU PUT AS THE DIRECTORY TO DELETE, I AM NOT RESPONSIBLE FOR ANY DATA LOSS) with 3 cool methods:
- Iterative removal: It removes the directory and contents in an iterative way. Not blazing fast, but RAM friendly :)
- Recursive removal: The fastest it can be done (in Java), it'll break down that directory in less time, but if it is very large (which is very likely to be), it'll eat through your RAM QUITE FAST, so be careful
- Directory flattening: In the rare cases the two above do not work, this'll do. It is EXTEMELY UNEFFICIENT, but in some scenarios it is necessary, it'll go through the directories inside the one we requested and move it's contents back one level (to the one we want to remove), iterate again and again and again until we have disassembled the whole thing down to a 1-depth directory and then call method 1. It is REALLY SLOW, but VERY resource friendly, and useful in EXTREME scenarios.
So, by using a combination of methods 1 and 3 I was able to remove a 5000+ subfolder deep folder. I hope it helps you as much as it did help me :D