1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

win_copy: Fix recursive copy (#23581)

This fixes #23559.

This should be backported to v2.3 branch too.
This commit is contained in:
Dag Wieers 2017-05-23 19:46:13 +02:00 committed by Matt Davis
parent dd4a79d7d3
commit 9cd6f1bf91

View file

@ -32,8 +32,9 @@ $original_basename = Get-AnsibleParam -obj $params -name "original_basename" -ty
$result = @{ $result = @{
changed = $false changed = $false
src = $src
dest = $dest dest = $dest
original_basename = $original_basename
src = $src
} }
if (($force -eq $false) -and (Test-Path -Path $dest)) { if (($force -eq $false) -and (Test-Path -Path $dest)) {
@ -122,6 +123,9 @@ if ($original_basename) {
} catch { } catch {
Fail-Json $result "Failed to create directory $($dest_folder): $($_.Exception.Message)" Fail-Json $result "Failed to create directory $($dest_folder): $($_.Exception.Message)"
} }
}
if ((Get-Item -Path $dest -Force).PSIsContainer) {
$dest = Join-Path $dest -ChildPath $original_basename $dest = Join-Path $dest -ChildPath $original_basename
} }
} }