File Modified Dependency

Follow

In addition to normal file dependencies that check for the existence, non-existence, or availability of a file, JAMS also supports watching for a file to be modified.  The following PowerShell script will watch for a file to be modified, and loop until the file has been modified.

$sinceTime = Get-Date
while($true)
{
  $fileInfo = Get-ChildItem FileToCheck.txt
  if ($fileInfo.LastWriteTime -gt $sinceTime)
  {
  break;
  }
  write-host "Sleeping"
  start-sleep 10
}
write-host "File has changed"
Have more questions? Submit a request

Comments