Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/oanderoficial/check_file_times
- Owner: oanderoficial
- Created: 2024-10-30T12:34:45.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T13:00:27.000Z (3 months ago)
- Last Synced: 2024-10-30T13:33:22.067Z (3 months ago)
- Topics: file, files, powershell-module, powershell-script, scripts
- Language: PowerShell
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```