Last active
January 17, 2017 20:14
-
-
Save drwelby/544b325cf058a8276b1a28ad98b4aeb6 to your computer and use it in GitHub Desktop.
Waze file backup using PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Powershell script to download a file from a url | |
// and save a timestamped copy | |
//================================================= | |
// SETTINGS | |
//The url of the file you want to download | |
$fileURL = 'https://na-georss.waze.com/YOUR/ENDPOINT' | |
// The directory where you want to store your backup. | |
// This needs to exist, it will not be created automatically | |
$targetDir = 'c:\path\to\your\directory' | |
// The base name of the backup file | |
// the date, time, and extension will be appended to this | |
// i.e. waze_backup-20160117-135517.xml | |
$targetBaseName = 'waze_backup-' | |
// The file extension for the file | |
// uncomment the one you need or modify | |
// $targetExtension = '.json' | |
$targetExtension = '.xml' | |
//================================================= | |
$dateTime = Get-Date -Format yyyyMMdd-HHmmss | |
$targetFileName = $targetBaseName + $dateTime + $targetExtension | |
$targetFilePath = Join-Path $targetDir -ChildPath $targetFileName | |
Invoke-WebRequest -Uri $fileUrl -OutFile $targetFilePath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment