https://github.com/jonlabelle/pwsh-daily-backup
Perform simple, daily backups of folders.
https://github.com/jonlabelle/pwsh-daily-backup
backup powershell
Last synced: about 1 year ago
JSON representation
Perform simple, daily backups of folders.
- Host: GitHub
- URL: https://github.com/jonlabelle/pwsh-daily-backup
- Owner: jonlabelle
- License: mit
- Created: 2022-03-27T01:13:29.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-01T14:29:55.000Z (about 2 years ago)
- Last Synced: 2025-01-23T03:29:25.307Z (over 1 year ago)
- Topics: backup, powershell
- Language: PowerShell
- Homepage: https://www.powershellgallery.com/packages/DailyBackup
- Size: 131 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# PowerShell Daily Backup
[](https://github.com/jonlabelle/pwsh-daily-backup/actions/workflows/ci-cd.yml)
[](https://www.powershellgallery.com/packages/DailyBackup)
> PowerShell module for performing simple daily backups.
## Installation
```powershell
Install-Module -Name DailyBackup
```
## Updating
```powershell
Update-Module -Name DailyBackup
```
## Usage
```console
NAME
New-DailyBackup
SYNOPSIS
Perform a daily backup.
SYNTAX
New-DailyBackup [-Path] [-Destination] -DailyBackupsToKeep [-WhatIf] [-Verbose]
DESCRIPTION
Create a new daily backup storing the compressed (.zip) contents in a
destination folder formatted by day ('yyyy-MM-dd').
PARAMETERS
-Path
The source file or directory path(s) to backup.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Destination
The root directory path where daily backups will be stored.
The default destination is the current working directory.
Required? false
Position? 2
Default value .
Accept pipeline input? false
Accept wildcard characters? false
-DailyBackupsToKeep
The number of daily backups to keep when purging old backups.
The oldest backups will be deleted first.
This value cannot be less than zero.
The default value is 0, which will not remove any backups.
Required? false
Position? named
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf []
When present, backup operations will not be performed.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
```
## Examples
To perform a daily backup of directories `C:\Users\Ron\Documents` and
`C:\Users\Ron\Music`, and store them as `C:\Users\Ron\iCloudDrive\{yyyy-MM-dd}\{basename}.zip`,
keeping only the latest 7 backups.
```powershell
Import-Module DailyBackup
New-DailyBackup `
-Path 'C:\Users\Ron\Documents', 'C:\Users\Ron\Music' `
-Destination 'C:\Users\Ron\iCloudDrive' `
-DailyBackupsToKeep 7 `
```
> **NOTE** If running multiple backups on the same day, the previous backup(s)
> will be destroyed and overwritten with the current backup.
> TODO: Maybe consider using the -Force option instead.
## Author
Jon LaBelle
## License
[MIT License](LICENSE.txt)