Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to create a batch file that will look in a directory, gather all of the subdirectories that contain 'DATA' in the directory name, and then output to a log file the subdirectory names and files and compute the total size of the subdirectories.
I also have robocopy which seems to have more features available and is listing each folders size, but I need it to compute the total size of all the folders.
To gather the directories that contain data in the name I am using:
for /f "tokens=1 delims=," %%i in ('DIR \\Erd-a04alx5678d\Buckeye1\*DATA* /AD /B') do call :docpy %%i
goto EOF
:docpy
Which is working, now I just need to get the size...

http://www.pcworld.com/downloads/file_description/0,fid,23075,00.asp
Not a batch file, but I use this all the time, a very neat app

Try this:
::== dirsizes.bat
@echo offdir c:\temp /s/b/ad | find /i "data" > datadirs
for /f "tokens=*" %%D in (datadirs) do call :sub1 %%D
goto :eof:sub1
dir /a-d "%*" | find /i "bytes" | find /i /v "free">dirsize
set /p size=<dirsize
echo %* contains %size%
goto :eof
:: DONE
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |