How can I monitor directory size?

How can I track the size of a folder? Q: I want to keep an eye on the size of a folder (the total size of all files within it). What’s the best way to achieve this? A: IPNetwork Monitor comes with several pre-built monitoring scripts. Among these is a utility that calculates the size of a directory. This program (dirsize_kb.exe) is included with both its source code and a batch file for compilation. To utilize this tool, choose ipnetwork_dirsize_kb.exe from the scripts directory within the IPNetwork Monitor installation path, and specify the following arguments:
directory or share name  the directory whose size you want to measure
-t timeout  the timeout period in seconds
-l domain:username:password  login credentials if required to connect to a remote server
A standard set of command-line parameters would look something like this:
\\SERVER\share -t 20 -l $AdminDomain:$AdminName:$AdminPassword
Keep in mind that computing the directory size can be time-consuming, so avoid running it too frequently to prevent system overload.
Related articles
How can I verify if a string exists in a file?