Computing.Net > Forums > Programming > Batch file to compute size of dir

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file to compute size of dir

Reply to Message Icon

Name: emanon2
Date: June 2, 2006 at 06:35:21 Pacific
OS: XP
CPU/Ram: 3GB
Product: Dell
Comment:

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...



Sponsored Link
Ads by Google

Response Number 1
Name: jhunt303
Date: June 2, 2006 at 08:55:02 Pacific
Reply:

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


0

Response Number 2
Name: ghostdog
Date: June 2, 2006 at 18:55:07 Pacific
Reply:

you can try out diruse utitlity from the resource tool kit..


0

Response Number 3
Name: Mechanix2Go
Date: June 2, 2006 at 22:10:57 Pacific
Reply:

Try this:

::== dirsizes.bat
@echo off

dir 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



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file to compute size of dir

Batch file to extract lines of text from .ini www.computing.net/answers/programming/batch-file-to-extract-lines-of-text-from-ini/19089.html

Batch File To temporarily backup www.computing.net/answers/programming/batch-file-to-temporarily-backup-/9826.html

Batch file to list dir name www.computing.net/answers/programming/batch-file-to-list-dir-name-/17362.html