Like this:
Code: Select all
@echo off
setlocal enabledelayedexpansion
set _folderstoclean[1]="c:myfoldera*"
set _folderstoclean[2]="c:myfolderb*"
set _folderstoclean[3]="c:myfolderc*"
for /l %%i in (1,1,3) do (
del /q !_folderstoclean[%%i]!
for /d %%x in (!_folderstoclean[%%i]!) do rd /s /q ^"%%x^"
)
This line:
Code: Select all
for /l %%i in (1,1,3) do (
"3" is the number of your folders in your array, in this case, we got 3 folders to clean:
Code: Select all
set _folderstoclean[1]="c:myfoldera*"
set _folderstoclean[2]="c:myfolderb*"
set _folderstoclean[3]="c:myfolderc*"
So if you had a fourth folder, you would add another line:
Code: Select all
set _folderstoclean[4]="c:myfoldera*"
...and change the 3 to 4:
Code: Select all
for /l %%i in (1,1,4) do (
Etc.