get-childitem 路徑 | where {$_.lastwritetime -lt (get-date).adddays(-7)} |% {remove-item $_.fullname}
【批次檔】
REM Remove files older than 7 days
forfiles /p "路徑" /s /m *.* /c "cmd /c Del @path" /d -7
【 PowerShell 】 get-childitem 路徑 | where {$_.lastwritetime -lt (get-date).adddays(-7)} |% {remove-item $_.fullname} 【批次檔】 REM Remov...