I'd like a script that'll monitor folder1, folder2, folder3 and create a log with their combined size, for Windows.
Would it be possible to do this开发者_JAVA百科 with a .bat file or something?
Thanks in advance.
Copying (and removing a few debug statements) from here: http://www.programmersheaven.com/mb/MS-DOS/382631/382631/dos-commandbatch-file-to-find-a-folder-size/
@For /F "tokens=*" %%a IN ('"dir folder* /s /-c | find "bytes" | find /v "free""') do @Set summaryout=%%a
@For /f "tokens=1,2 delims=)" %%a in ("%summaryout%") do @set filesout=%%a&set sizeout=%%b
@Set sizeout=%sizeout:bytes=%
@Set sizeout=%sizeout: =%
@Echo Size is :%sizeout%
You might have to change this a bit, for I considered the folders (as you specified) are similarly named.
精彩评论