give me a couple minutes.. i'll whip up something for you
edit: here ya go
Code:
@echo off
dir /b /ad %1 > dirlist.txt
for /f %%i in (dirlist.txt) do rd /s /q %1\%%i
del %1\*.*
del dirlist.txt
Save it to a batch file.. run it from the command line and pass the base directory to it as a parameter.
Example:
Let's say the batch file is called.. "delsub.bat" and it's saved to the root of the C: drive.. and you have a directory c:\work that you want to delete all the sub directories from.. you would do as follows:
c:\> delsub c:\work
IMPORTANT: you shouldn't add a trailing "\" to the directory name you pass.
edit2:
If you want to know how it works..
@echo off
Hopefully you know what this does..
dir /b /ad %1 > dirlist.txt
Creates a file called dirlist.txt in the current working directory that contains a list of all the the subdirectories of the base directory. The "/b" does a bare listing (only the names.. none of the dates, etc). The "/ad" switch just lists the directories. The "> dirlist.txt" portion redirectes the output of the command to a file called dirlist.txt
for /f %%i in (dirlist.txt) do rd /s /q %1\%%i
Loops through the dirlist.txt file reading the directory names and runs the command "rd /s /q <directory name> for each subdirectory listed in the file. I won't go into all the switches available with the for command.. running "for /?" from the command prompt will display several pages of info.
del %1\*.*
Deletes all the files from the base directory
del dirlist.txt
Just does a little cleanup and deletes the dirlist.txt file it created. You can comment/delete this line out if you to retain the list of directories that were deleted.
edit3: made some changes because I noticed in an earlier post that you did want to delete the files out of the base directory as well.