mirror of
https://github.com/zebrajr/sysadmin.git
synced 2025-12-06 00:20:23 +01:00
Added: Limit Backups
This commit is contained in:
parent
8a3b3895f3
commit
3f7dd55d2b
22
Windows/Limit Backups/README.md
Normal file
22
Windows/Limit Backups/README.md
Normal 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
|
||||
3
Windows/Limit Backups/limitBackups.ps1
Normal file
3
Windows/Limit Backups/limitBackups.ps1
Normal 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
|
||||
Loading…
Reference in New Issue
Block a user