Detect if a file has been modified (SolarWinds)

FileModified

The FileModified script allows you to watch a file to make sure it has not changed since the last time it was monitored. The script compares both the size of the file and the last-modified date to a state file that is generated as a baseline. The file size in bytes is returned as a statistic, allowing you to set thresholds and alerts on the file size.

 

This script requires temporary storage space to store the state file. To reset the status of the component after a file modification has been detected, you must manually delete the .statefile. Deleting the .statefile allows the script to generate a new baseline for future file comparisons. 

 

Arguments 

filePath stateFilePath

 

filePath

The local path or Universal Naming Convention (UNC) path to the file.

 

stateFilePath

The local path or UNC path to a folder for storing the state file. The state file has a .state file extension.

 

Example

These arguments monitor the file C:\temp\test.txton the localhost, and uses the C:\tempfolder of the localhost for storing the state file. The paths are in UNC syntax.

 

\\localhost\c$\temp\test.txt \\localhost\c$\temp\
FormerMember
FormerMember