Script to Delete All Subfolders

Was looking for a script to go into a specific folder and delete all folders but leave the files in the root folder.

This is the script that we used in a batch file

powershell
e:
cd \
cd test
for /d %%a in (?*) do rd /s /q "%%a"
pause

Comments