@echo off
setlocal enabledelayedexpansion
echo PushAllToCurrent - Running all 0MoveToCurrent.bat files in daily_ folders...
echo.

echo Searching for daily_ folders and 0MoveToCurrent.bat files...
echo.

REM Find all daily_ folders and check for 0MoveToCurrent.bat
set /a count=0
set /a found=0

echo Found the following daily_ folders with 0MoveToCurrent.bat:
for /d %%D in (daily_*) do (
    if exist "%%D\0MoveToCurrent.bat" (
        echo   - %%D
        set /a found+=1
    )
)

if !found!==0 (
    echo No daily_ folders with 0MoveToCurrent.bat found!
    pause
    exit /b 1
)

echo.
echo Found !found! folders with 0MoveToCurrent.bat files.
echo.
echo Starting execution...
echo.

REM Execute each 0MoveToCurrent.bat found in daily_ folders
for /d %%D in (daily_*) do (
    if exist "%%D\0MoveToCurrent.bat" (
        set /a count+=1
        echo [!count!/!found!] Running 0MoveToCurrent.bat in %%D...
        pushd "%%D"
        call "0MoveToCurrent.bat"
        popd
        echo   Completed: %%D
        echo.
    )
)

echo.
echo Operation completed. Successfully executed !count! batch files.
pause 