Computer Hope
Microsoft => Microsoft DOS => Topic started by: kordi on October 14, 2008, 02:42:37 PM
-
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. :P Sorry For My Bad English :P Waiting for your help...Ty
-
rd /s [Name Of Folder]
That is the correct format to use. Specifically what did you use for name of folder?
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.
8)
-
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 *.*????
-
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.
@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.