watchDirectory Help > Plugins > Monitor Directory Size
Monitor the size of your folders
This watchDirectory plugin alerts you by email when a directory is filling up with files. Optionally, it can move or remove the oldest files to free up space.Settings for this plugin
When, inside the monitored folder....
Here you select when watchDirectory should warn you and/or remove files. Choose between these possibilities:
Select this option if you want to be alerted when there are more than a given number of files present. Each time a file is created or deleted, watchDirectory will do a quick count to see if the limit is reached.
the total size of all files is more than XXX megabytes
Select this option if you want to be alerted when the files inside the monitored directory use more than XXX megabytes. Each time a file is created, changed or deleted, watchDirectory will count the size of all files to see if the limit is reached.
the available disk space is less than XXX megabytes
Select this option if you want to be alerted when the disk space available is less than XXX megabytes. Each time a file is created, changed or deleted, watchDirectory will compute the disk space available to see if the limit is reached.
Note that this option triggers for files in the monitored directory (just like the other options), but reacts based on the space available on the complete drive.
there are LESS than XXX files
Select this option if you want to be alerted when there are less than a given number of files present. Each time a file is created or deleted, watchDirectory will do a quick count to see if the limit is reached.
the total size of all files is LESS than XXX megabytes
Select this option if you want to be alerted when the files inside the monitored directory use less than XXX megabytes. Each time a file is created, changed or deleted, watchDirectory will count the size of all files to see if the limit is reached.
the available disk space is MORE than XXX megabytes
Select this option if you want to be alerted when the disk space available is more than XXX megabytes. Each time a file is created, changed or deleted, watchDirectory will compute the disk space available to see if the limit is reached.
Note that this option triggers for files in the monitored directory (just like the other options), but reacts based on the space available on the complete drive.
Value for XXX
The 6 different options described above all need a "parameter" (the XXX in their description). Here you set the value
for that parameter.
Send an email alert
Select this option if you want to send an email when the disk becomes full. For the email option to work, you must properly configure the email processor before you run this task.
Enter an email address to send the alert to.
You can either enter the address like admin@YourHost.com, or like Your Name<admin@YourHost.com>.
Subject
Enter a subject for the email message.
How Often (minutes)
Limit how often an email is sent. This defaults to at most one per 30 minutes.
In some cases this limit is ignored, for example if you have set this task to also delete files it will always email you the list of deleted files.
Move or Remove files from the monitored directory
WatchDirectory can also remove files based on the criteria you set. It will remove files until the option set above is not true anymore.
For example, if you selected "There are more than XXX files", with "value for XXX" set to 100, WatchDirectory will remove files
until there are 100 files left. The oldest files are deleted first.
Enter one or more search patterns for files that can be deleted. If all files are allowed to be deleted, then just enter "*.*" here. If you want to delete BAK and LOG files, enter *.bak;*.log (separate entries with a semicolon).
Oldest file first/In pattern order
When you enter multiple patterns above, you can tell WatchDirectory the order in which you want the files deleted. If you select Oldest file first (all patterns), WatchDirectory will delete the oldest files that match any of the patterns.
If you select In pattern order, WatchDirectory will first delete the files that match the first pattern, and only if there is not enough disk space freed after that, WatchDirectory will delete files matching the next pattern.
File Age based on Last Modified Date
If this option is selected, WatchDirectory will base the calculation of file age on the Last Modified timestamp only. If it is not selected, WatchDirectory will take both the Last Modified and the Creation timestamp of files into account when calculating the age of the file.
Delete 10% extra files
This option will remove 10% extra files. If you selected "There are more than XXX files", with "value for XXX" set to 1000 and there are 1005 files inside the monitored directory, WatchDirectory would normally delete 5 files. By selecting this option, WatchDirectory will remove 105 files.
Remove empty directories
When a directory becomes empty after deleting files, WatchDirectory can optionally remove the empty directory.
Test mode
You may feel more comfortable to run this task in test mode first. When test mode is active, the filenames that would have been removed are included in the email alert, and written to the Task History database.
Move, instead of delete
Enter a new location plus filename here to let watchDirectory move the old files, instead of deleting them. Note that you should enter the new filename using Dynamic Naming. If you just want the files moved to another disk (for example D:), and have them moved to the "same" directory on D:, use D:\{relativedir}\{filename}.
Press the {Tag} button to choose from the different tags available.