pull/83536/head
Brian Coca 5 months ago
parent c14ed24d16
commit 22ed94ca87

@ -19,15 +19,15 @@ Function Backup-File {
$backup_path = $null $backup_path = $null
if (Test-Path -LiteralPath $path -PathType Leaf) { if (Test-Path -LiteralPath $path -PathType Leaf) {
$dirname = Split-Path -Parent $path -Resolve $dirname = Split-Path -Parent $path -Resolve
# set variables for templating purposes # set variables for templating purposes
$basename = Split-Path -Path $path -Leaf -Resolve $basename = Split-Path -Path $path -Leaf -Resolve
$stripname = Split-Path -Path $path -LeafBase -Resolve $stripname = Split-Path -Path $path -LeafBase -Resolve
$extension = Split-Path -Path $path -Extension -Resolve $extension = Split-Path -Path $path -Extension -Resolve
$timestamp = [DateTime]::Now.ToString("yyyyMMdd-HHmmss") $timestamp = [DateTime]::Now.ToString("yyyyMMdd-HHmmss")
# TODO: make childpath configurable via template stirng from config # TODO: make childpath configurable via template stirng from config
$backup_path = Join-Path -Path $dirname -ChildPath "$basename.$pid.$timestamp.bak" $backup_path = Join-Path -Path $dirname -ChildPath "$basename.$pid.$timestamp.bak"
Try { Try {
Copy-Item -LiteralPath $path -Destination $backup_path Copy-Item -LiteralPath $path -Destination $backup_path

Loading…
Cancel
Save