From 22ed94ca8741f24e5fb05b355907f4376a4986e0 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 10 Jul 2024 15:14:11 -0400 Subject: [PATCH] wstrans --- .../powershell/Ansible.ModuleUtils.Backup.psm1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Backup.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Backup.psm1 index aad9eb4838b..6b5be0fa634 100644 --- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Backup.psm1 +++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Backup.psm1 @@ -19,15 +19,15 @@ Function Backup-File { $backup_path = $null if (Test-Path -LiteralPath $path -PathType Leaf) { - $dirname = Split-Path -Parent $path -Resolve + $dirname = Split-Path -Parent $path -Resolve - # set variables for templating purposes - $basename = Split-Path -Path $path -Leaf -Resolve - $stripname = Split-Path -Path $path -LeafBase -Resolve - $extension = Split-Path -Path $path -Extension -Resolve - $timestamp = [DateTime]::Now.ToString("yyyyMMdd-HHmmss") + # set variables for templating purposes + $basename = Split-Path -Path $path -Leaf -Resolve + $stripname = Split-Path -Path $path -LeafBase -Resolve + $extension = Split-Path -Path $path -Extension -Resolve + $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" Try { Copy-Item -LiteralPath $path -Destination $backup_path