Get total directory size using just DIR command

@echo off

set total=0


set MYDIR=C:\TEMP\MINT

for /F "tokens=3" %%F in ('dir /s /a:-d /-C %MYDIR% ^| find "File(s)"') do set F=%%F

set F=%F:~0,-6%

REM round up

set /A F=%F%+1

echo DIRECTORY %1 is %F% MB

set /a total=%total%+%F%


set MYDIR=C:\TEMP\agfm151

for /F "tokens=3" %%F in ('dir /s /a:-d /-C %MYDIR% ^| find "File(s)"') do set F=%%F

set F=%F:~0,-6%

REM round up

set /A F=%F%+1

echo DIRECTORY %1 is %F% MB

set /a total=%total%+%F%


REM more here .....


echo TOTAL=%total% MB

REM adjust by 1.048576 for conversion to MiB

set /A TOTAL=%total%000/1048

echo TOTAL=%TOTAL% MiB