카테고리 없음

특정 날짜 기준 파일 삭제 PowerShell Script

KSI 2022. 5. 10. 18:00
Start-Transcript -path "C:\PowerShellScript\LOG.txt" -Append
Get-ChildItem -path "C:\Temp\*.*" | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-15))} | Remove-Item
Get-ChildItem -path "C:\Temp\*.*" | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-15))} | Remove-Item
Get-ChildItem -path "C:\Temp\*.*" | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-15))} | Remove-Item
Stop-Transcript