How to remove a subfolder with unknown folder name?

786 views Asked by At

I have a folder D:\test1 and I have another folder inside that whose name is not known.

I tried using rmdir /s "D:\test\*", but it is showing an error.

I just want to know is there any way of doing this operation?

In shell script if we give rmdir "D:\test1\*" it will remove all directories inside test1.

I am looking for the command in batch syntax.

1

There are 1 answers

0
Mofi On BEST ANSWER

I suggest

@echo off
for /D %%F in ("D:\test1\*") do rmdir /S /Q "%%F"

It deletes all subfolders in D:\test1 recursively even if subfolders contain one or more spaces in folder name.