14. March 2013
von Blackbam
Recently I have been confronted with a very annoying bug Windows bug, when working with Aptana Studio on Windows. For some reason the system has frozen when I wanted to create a backup by copying some files and the program created a very, very deep folder structure. It took me some time to realize this. At this time the folder structure was probably nested thousands of times. When you try to delete this folder structure on Windows it is not possibly, there have been errors like folder structure not empty. So I was searching for hours on the Internet for a program to remove this folder structure (Aptana which caused the error was freezing when I tried to remove it). Not even one single programs promising to solve this problem did work, which was quite annoying. After some time I found a little blog (forgot the name unfortunatly), which recommended to write a custom script - I did this and the problem was solved in less than 5 minutes.If you have a problem like that, just do the following:

1. Create an empty stack file (.bat), name it like remove_me.bat

2. Insert the following contents:

 ren "C:\xampp\htdocs\abc\local\wp-content\themes\abc\remove_me\folder_1" x

 move "C:\xampp\htdocs\abc\local\wp-content\themes\abc\remove_me\x\folder_2\folder_1" "C:\xampp\htdocs\abc\local\wp-content\themes\abc\remove_me\"

 rd "C:\xampp\htdocs\abc\local\wp-content\themes\abc\remove_me\x" /s /q

3. Adjust the paths to your needs

Of course you have to adjust the path to your system for this script to work

4. Just click the file and you can see a command prompt window which shows deletion of the folders

5. Close the window if you see a lot of error messages

This means all folders are deleted and the script cannot delete any more. Explanation: The script creates an endless loop. It will rename the the endless folders (line 1),  fetch the a folder from two levels below, and move it to the current level  (line 2) and remove the two directories which can be deleted now (line 3).

Dieser Eintrag wurde am 14. March 2013 um 22:22 in der Kategorie Allgemein veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.

Already 4 comments belonging to "Delete infinite folder structure on Windows":

Kommentare abonnieren (RSS) or URL Trackback

stevenkor   says:

on 17. July 2013 at 08:40 on clock ()

Impressive, anyway here's my alternative solution Try " Long Path Tool " is also useful in situations where you see these error messages: Cannot read from source file or disk, there has been a sharing violation, cannot delete file or folder, the file name you specified is not valid or too long, the source or destination file may be in use and many other file managing errors that you encounter in your computing use.

Blackbam     says:

on 17. July 2013 at 23:16 on clock ()

Hello thank you for your advice. However, I have tried "Long Path Tool" and it did not solve my problem. But as it may be useful for somebody else, I decided to allow your comment.

stevenkor   says:

on 19. July 2013 at 18:49 on clock ()

Thanks a lot..

Bob   says:

on 21. September 2013 at 13:15 on clock ()

I found a small free tool which did work for me. http://deepremove.codeplex.com/

Leave a comment: