Hello
Here is what I want, inside the BACKUPDIR
, I want to execute cscript /nologo c:\deletefile.vbs %BACKUPDIR%
until number of files inside the folder is greater than 21(countfiles
holds it).
Here is my code:
@echo off
SET BACKUPDIR=C:\test
for /f %%x in ('dir %BACKUPDIR% /b ^| find /v /c "::"') do set countfiles=%%x
for %countfiles% GTR 21 (
cscript /nologo c:\deletefile.vbs %BACKUPDIR%
set /a countfiles-=%countfiles%
)