Directory Size
10:38 PM@echo off:: ===================================================================================================:::: Name: dirsize.cmd:: Description: Script written to poll directory size attributes into flat files for each server:: specified in the accompanying dirs.txt and servers.txt file:: Written By: Aslam latheef:: Date: 8/4/2010:::: Script Usage: dirsize.cmd:: Result Code: N/A:: Example: D:\Windows\Scripts\dirsize.cmd:::::: *** Notes ***:::: 1) Batch script requires the du.exe command line utility from sysinternals.com:: 2) The file servers.txt should be in the same directory with the contents having on each line a:: single server that can be resolved by the client.:: 3) The file dirs.txt are the directories identified one per line that are needed for stats.:: 4) All content gets written to by default the D:\WINDOWS\Scripts directory:: 5) The script assumes the system has remote CIFS access to the directories specified in the :: dirs.txt file. :: 6) For more information or help, please email corp-tech@opsource.net.:::: ===================================================================================================:: Sets help variableset HELPMSG=/?:: Checks for help argument being passedIF "%1" == "%HELPMSG%" GOTO USAGE:: Set user defined variablesSET OPSBINDIR=D:\Program Files\opsbinSET PARSESRVFILE=D:\WINDOWS\Scripts\servers.txtSET PARSEDIRFILE=D:\WINDOWS\Scripts\dirs.txtSET LOGDIR=D:\WINDOWS\Scripts:: ===================================================================================================:::: *** WARNING - DO NOT MODIFY!!! ****:::: Please do not modify the code below this section as that can cause the script to fail or perform:: in an unintended manner. If you decide to anyways, do at your own risk.:::: ===================================================================================================:: For loop that requires du.exe to run successfully; Command exports data for each server name in the :: LOGDIR variable above@echo onfor /f %%i in (%PARSESRVFILE%) do ( for /f "tokens=1 delims=," %%j in (%PARSEDIRFILE%) do "%OPSBINDIR%\du.exe" -q "\\%%i\%%j") >> %LOGDIR%\%%i_Results.log@echo offecho.echo Please go to the directory %LOGDIR% to see the results...echo.pauseGOTO END:ENDexit:USAGEecho.echo *** Usage ***echo.echo Script Usage: dirsize.cmdecho Result Code: N/Aecho Example: D:\Windows\Scripts\dirsize.cmdecho.echo For more information on the script contents please read the remarksecho at the top of this batch file.
0 comments