A Powershell script that allows a user to backup and restore a list of files or file paths via a GUI.
- Clone or download this repo
- Go into the
examplefolder and double-click thegenFiles.batfile. It'll then set up some folders and files of varying sizes. - Then go back up to the root of this repo and right-click
moving-time.ps1and select Run with Powershell. - Once the GUI opens, click the Start Backup button.
- Once the script has completed you'll see the
example/outputfolder now has abackupfolder in it, with the folders and files specified inexample/conf.psd1.
- Once the script has completed you'll see the
- After the backup has completed, rename
example/sourcetoexample/source.bak. - Click the Restore radio at the top of the GUI and then click the
Start Restore button.
- Once the script has completed you'll see the
example/sourcefolder has been created, containing the files and folders fromexample/output.
- Once the script has completed you'll see the
- Copy the file
example/conf.psd1to the root of the repo - At the top of
moving-time.ps1- Find the
# Import configline, and edit the below lines to look like:
$conf = Import-PowerShellDataFile ".\conf.psd1" # $conf = Import-PowerShellDataFile ".\example\conf.psd1"
- Find the
Here are the available top-level options for a config:
| Prop | Type | Value |
|---|---|---|
bagPath |
String |
Absolute or relative path to where files will be backed up to or restored from. |
itemsList |
Array of HashTable |
The available properties for itemsList are listed below. Optional properties
are surrounded in [<NAME>].
| Prop | Type | Value |
|---|---|---|
label |
String |
The name that will be printed above each item being synced. |
paths |
Array of String |
Absolute or relative path to a folder or file. |
[excludedFiles] |
String |
A space delimited list of file names or paths that won't be synced. |
[excludedFolders] |
String |
A space delimited list of folders that won't be synced. |
[filters] |
String |
Files or file types that will be synced. It uses Robocopy's File syntax for patterns. |
[recursive] |
Boolean |
All syncs are recursive by default, but if you want to only copy top-level files, you would set this to $false. |
- Right-click
moving-time.ps1and select Create Shortcut - Right-click the new shortcut and select Properties
- Change Target to
%WINDIR%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File ".\moving-time.ps1". If you want to have the shortcut in another location other than this folder, change.\moving-time.ps1to be the absolute path of the file. - Click the Change Icon button, navigate to this folder and select
assets/app.ico.
Now you can just double click the shortcut and it'll run via Powershell.
- Generated
.icofile via https://redketchup.io/icon-editor - Got the icon from https://www.synology.com/zh-tw/dsm/packages/ActiveBackup
- Used this online tool to flesh out the GUI https://poshgui.com/Editor
