How to use PowerShell to delete files older than X days on Windows 10

Configurare noua (How To)

Situatie

Vreti sa stergeti automat fisierele care nu au fost modificate in ultima luna, sau in orice numar de zile specificat in windows 10.

Solutie

Pasul 1. Deschidem PowerShell cu drepturi de administrator

Pasul 2. Scriem urmatoarea comanda :

Get-ChildItem –Path “C:xxxx” -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item

unde xxxx – este calea fisierului de unde vreti sa stergeti.

Tip solutie

Permanent

Voteaza

(7 din 19 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?