diff --git a/Windows/Limit Backups/README.md b/Windows/Limit Backups/README.md new file mode 100644 index 0000000..ed5f15d --- /dev/null +++ b/Windows/Limit Backups/README.md @@ -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 diff --git a/Windows/Limit Backups/limitBackups.ps1 b/Windows/Limit Backups/limitBackups.ps1 new file mode 100644 index 0000000..016eafc --- /dev/null +++ b/Windows/Limit Backups/limitBackups.ps1 @@ -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