Added: Limit Backups

This commit is contained in:
Carlos Sousa 2021-08-09 13:59:16 +02:00
parent 8a3b3895f3
commit 3f7dd55d2b
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,22 @@
### Situation
A software has a dedicated way to create backups, but not to rotate them.
### Task
Be able to keep N latest Backups, therefore maintaing Data Integrity but decreasing space requirements.
### Action
### Result
### Note
None
### ToDo
- Add Script Description
- Add description on how to add the script to a Scheduled Task
- Add "Action" on README.md
- Add "Result" on README.md
- Add Scheduled Task xml
- Add Logging

View File

@ -0,0 +1,3 @@
$BackupPath = "C:\Lexware\Backup"
$BackupLimit = 30
Get-ChildItem $BackupPath -Recurse| where{-not $_.PsIsContainer}| sort CreationTime -desc| select -Skip $BackupLimit | Remove-Item -Force