Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oanderoficial/check_file_times

Check if there are files in a folder for more than 30 minutes
https://github.com/oanderoficial/check_file_times

file files powershell-module powershell-script scripts

Last synced: about 2 months ago
JSON representation

Check if there are files in a folder for more than 30 minutes

Awesome Lists containing this project

README

        

# Check file times

Verifica se há algum arquivo criado há mais de 30 minutos em uma pasta de rede específica ($pasta) e registra o valor em um arquivo de ($log) .


Se algum arquivo com mais de 30 minutos for encontrado, o valor 1 é gravado no log, indicando a existência de um arquivo "antigo". Caso contrário, o valor permanece 0.


```ps1
$pasta = "\\SERVERBR001\OSGT_CLOUD\MBBRAS "
$log = "C:\Zabbix\Scripts\monitoramento_share\MBBRAS.log"
$limite = (Get-Date).AddMinutes(-30)

$tempo = 0

Get-ChildItem -Path $pasta | ForEach-Object {
if ($_.CreationTime -lt $limite) {
$tempo = 1
}
}

Set-Content -Path $log -Value $tempo
```