@ -60,10 +60,10 @@ if (Test-Path $dest -PathType Container)
$dest = Join-Path $dest $original_basename
}
$ dest _checksum = Get-FileChecksum ( $dest )
$ orig _checksum = Get-FileChecksum ( $dest )
$src_checksum = Get-FileChecksum ( $src )
If ( $src_checksum . Equals ( $ dest _checksum) )
If ( $src_checksum . Equals ( $ orig _checksum) )
{
# if both are "3" then both are folders, ok to copy
If ( $src_checksum . Equals ( " 3 " ) )
@ -75,7 +75,7 @@ If ($src_checksum.Equals($dest_checksum))
}
}
ElseIf ( ! $src_checksum . Equals ( $dest _checksum) )
ElseIf ( -Not $src_checksum . Equals ( $orig _checksum) )
{
If ( $src_checksum . Equals ( " 3 " ) )
{
@ -88,17 +88,20 @@ ElseIf (! $src_checksum.Equals($dest_checksum))
# verify before we return that the file has changed
$dest_checksum = Get-FileChecksum ( $dest )
If ( $src_checksum . Equals ( $dest_checksum ) )
If ( $src_checksum . Equals ( $dest_checksum ) )
{
$result . changed = $TRUE
If ( -Not $orig_checksum . Equals ( $dest_checksum ) ) {
$result . changed = $TRUE
}
}
Else
{
Fail-Json ( New-Object psobject ) " src checksum $src_checksum did not match dest_checksum $dest_checksum Failed to place file $original_basename in $dest "
}
# generate return values
$info = Get-Item $dest
$result . size = $info . Length
$result . src = $src
$result . dest = $dest
Exit-Json $result