1.

Solve : Dos script to delete all subdirectories inside a directory?

Answer»

Hello, i need to delete all subdir inside a specific DIRECTORY, and someone help me?Code: [Select]C:\>rd /?
REMOVES (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the SPECIFIED directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S
But i dont want to del the main dir,

Let's see, i have c:\PrintTemp\Folder\, and inside of Folder i have subfolders and files, i only want to delete subfolder and let the files in the main dir stay.




Thanks in advance

Then you will want to use this
Code: [Select]FOR /D %variable IN (set) DO COMMAND [command-parameters]

If set contains wildcards, then specifies to match against directory
names instead of file names.so your code would look something like this
Code: [Select]@Echo off
For /D %%a in ("%1") do RD /S/Q "%%a"



Discussion

No Comment Found