資料出處:http://jojochen.blog.ithome.com.tw/post/2529/124548
由 JojoChen 發表於 [ Script ]
(1029) 閱讀, (0) 引用, (0) 回應 , 推文( 0 )
為了方便統計各NAS資料夾大小,使用Windows Server 2003 Support Tools其中一個diruse.exe程式,計算NAS各資料夾使用的大小,再利用免費郵件工具bmail來傳送給系統管理者,方便後續的維護與追踪,並設定排程,批次檔內容如下:
del /q d:\nas1-folder-use.txt
DIRUSE /s /m \\nas\ShareFolder1 >> d:\nas-folder-size.txt
DIRUSE /s /m \\nas\ShareFolder2 >> d:\nas-folder-size.txt
DIRUSE /s /m \\nas\ShareFolder3 >> d:\nas-folder-size.txt
bmail -s MailServer -t jojo@test.com -f jojo@test.com -a "Nas Folder Size" -m d:\nas-folder-size.txt
diruse.exe的說明如下:
C:\>diruse /?
DIRUSE displays a list of disk usage for a directory tree(s). Version 1.20
DIRUSE [/S | /V] [/M | /K | /B] [/C] [/,] [/Q:# [/L] [/A] [/D] [/O]] [/*] DIRS
/S Specifies whether subdirectories are included in the output.
/V Output progress reports while scanning subdirectories. Ignored if /S is
specified.
/M Displays disk usage in megabytes.
/K Displays disk usage in kilobytes.
/B Displays disk usage in bytes (default).
/C Use Compressed size instead of apparent size.
/, Use thousand separator when displaying sizes.
/L Output overflows to logfile .\DIRUSE.LOG.
/* Uses the top-level directories residing in the specified DIRS
/Q:# Mark directories that exceed the specified size (#) with a "!".
(If /M or /K is not specified, then bytes is assumed.)
/A Specifies that an alert is generated if specified sizes are exceeded.
(The Alerter service must be running.)
/D Displays only directories that exceed specified sizes.
/O Specifies that subdirectories are not checked for specified size
overflow.
DIRS Specifies a list of the paths to check.
Note: Parameters can be typed in any order. And the ‘-‘ symbol can be
used in place of the ‘/’ symbol.
Also, if /Q is specified, then return code is ONE if any directories are
found that
exceed the specified sizes. Otherwise the return code is ZERO.
Example: diruse /s /m /q:1.5 /l /* c:\users
近期留言