title: Calculation of directory size in DOS batch file
body: <p>I have written a Batch file to get the disk space from the list of directories provided. While converting the bytes to KB or MB, no data getting printed.</p>
  
  <pre><code>@echo OFF
  REM SQL CALL TO GET THE DIRECTORY LISTING
  FOR /F "tokens=*" %%i in (directoryList.txt) DO (
      for /F "tokens=3" %%S in ('dir %%i ^| findstr /c:"File(s)"') do (
          SETLOCAL
          SET /A "sizeKB=%%S/1024"
          SET /A "sizeMB=%sizeKB% / 1024"
          ECHO "Directory :: %%i with size :: %%S "
          ECHO "IN MEGABYTE :: %sizeMB%"
          ENDLOCAL
          PAUSE
      )
  )
  </code></pre>
  
  <p>Output of the above script is ...</p>
  
  <pre><code>Directory :: D:\xxx with size :: 723,234,123
  IN MEGABYTE :: 
  </code></pre>
  
  <p>Please correct the above code.</p>