Quantcast
Viewing all articles
Browse latest Browse all 16365

Help needed with modifying PS script for folder age for SAM 6.2

I have the following requirements for a monitor

 

If there are any files that exist in this location that end in "_N", with a "Date Modified" > 1 day (or 24 hours) beyond the current date, send a notification to the High Jump Developers group with the following instructions

 

I have a PS script that i used to work which can monitor the amount of files based on the folder name, age and type of files. I need help with modification of the script to include the name of the files

 

Below is the script i want to modify which gives me the list of files in the folder based on the criteria. In this PS i want to add the naming requirement.

 

[string]$path = "\\AArcWiVPWb10021\inetpub\ftproot\CustEDI\Replenishment"

[string]$filter = "*.xml"

[int]$maxAgeMinutes = 20

 

 

# Count of overdue files

$cnt = (Get-ChildItem -Path $path -Filter $filter | Where-Object {$_.CreationTime -lt [DateTime]::Now.AddMinutes(-$maxAgeMinutes)}).Count

 

 

if ($cnt -eq $null) {

  $cnt = 0;

  }

 

 

Write-Host 'Statistic: ' $cnt

write-host 'Message: ' "\\AArcWiVPWb10021\inetpub\ftproot\CustEDI\Replenishment"

Exit 0;

 

 

if ($cnt -gt 0)

{

    exit (0)

} else {

    exit (1)

}

 

 

Any help is greatly appreciated


Viewing all articles
Browse latest Browse all 16365

Trending Articles