1.

Solve : Help!!! How Do I Delete All folder From A Directory?

Answer»

I have a problem deleting all folders in a directory.The only way i found is to use rd /s [NAME Of Folder],but i want to delete all folders at once... I tried rd /s *.* & rd /s * but that did not worked.The same with del command. SORRY For My Bad English Waiting for your help...TyCode: [Select] rd /s [Name Of Folder]

That is the correct format to use. Specifically what did you use for name of folder?

Quote

but i want to delete all folders at once

What result did you get?

Note: Expect incorrect results if you're logged-in to any directory within the named folder tree structure.

First of all i want to thank you,for replying in my post.Now if i have a folder named Folder1 i write rd /s Folder1.With this way i delete the folder and all the subfolders contains in it.My problem is if i have in a folder other 10 folders.How can i delete these 10 folders all at once???(I don't want to delete the first folder,i want to enter to first folder and then delete everything that is in it. Waiting....In order to GIVE you UNDERSTAND i'll give you an other example.If i want to delete all the files a folder contains i write del /q *.* .Now with rd what should i write instead of *.*?Quote
I don't want to delete the first folder,i want to enter to first folder and then delete everything that is in it

That was an important piece of information.

Code: [Select]@echo off
for /f "tokens=* delims=*" %%i in ('dir /s /b /a-d folder1') do (
del /f %%i
)
for /f "tokens=* delims=*" %%i in ('dir /s /b /ad folder1') do (
rd /s /q %%i
)

Note: You should use a fully qualified path to folder1. The code is written as a batch file to be run from the command prompt.
I will look for what this loop does.Now i can't understand exactly.I will look for it and you will have my reply if i accomplished it.


Discussion

No Comment Found