The counting should work fine, i tested before with 2 and up to 5 files and it was always work fine, so it could be something wrong in your system like the one that require you to provide the full path to all files,
any way try these:
Editedadd ping localhost -n 3 >nul
before this lines :
ping localhost -n 3 >nul
:: Check files count
::Echo Counting files in local folder
set Fcount=0
For /F "delims=" %%a in ('Dir /B "%~6\*.*"') Do set /a Fcount += 1
to give few seconds for the files to be created and counted
and change this block of code:
Code: Select all
:: Check Condition to Exit or Continue Looping
::Echo Check count number
Setlocal EnableDelayedExpansion
IF "%Fcount%" EQU "%~5" (
type nul>"%~6\Zerobyte.txt"
"%zip_program%" x -y "%~6\*.%zipped%" -o"%~6" >nul
Del /F /Q "%~6\*.%zipped%" >nul
RMDIR /S /Q "%temp%\%~8" >nul
Goto :EOF
) Else (
Del /F /Q "%temp%\%~8\server_list.lst" >nul
:: Wait 5 min
Ping Localhost -l 1 -n 300 >nul
Goto :loop )
to this:
Code: Select all
:: Check Condition to Exit or Continue Looping
::Echo Check count number
Setlocal EnableDelayedExpansion
IF "%Fcount%" EQU "%~5" (
type nul>"%~6\Zerobyte.txt"
"%zip_program%" x -y "%~6\*.%zipped%" -o"%~6" >nul
Del /F /Q "%~6\*.%zipped%" >nul
RMDIR /S /Q "%temp%\%~8" >nul
Goto :EOF
)
Del /F /Q "%temp%\%~8\server_list.lst" >nul
:: Wait 5 min
Ping Localhost -l 1 -n 300 >nul
Goto :loop
maybe the if statement doesn't work for you