开发者

Script to monitor and log folder size of multiple folder (Windows)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜