Differences

This shows you the differences between the selected revisions of the page.

2023-01-11 2023-01-11
making refresh optional to allow standalone execution (martin) not failing when specific file do not require any rename (when the underlying protocol fails noop renames) (martin)
Line 62: Line 62:
        {         {
            $newName = $file -replace $pattern, $replacement             $newName = $file -replace $pattern, $replacement
-            Write-Host "$file => $newName" +            if ($newName -eq $file)
-············if ($newName -ne $file)+
            {             {
 +                Write-Host "$file not changed"
 +            }
 +            else
 +            {
 +                Write-Host "$file => $newName"
                $anyChange = $True                 $anyChange = $True
            }             }
Line 121: Line 125:
            {             {
                $newName = $file -replace $pattern, $replacement                 $newName = $file -replace $pattern, $replacement
-                Write-Host "$file => $newName"+                if ($newName -eq $file) 
 +                { 
 +                    Write-Host "$file not changed" 
 +                } 
 +                else 
 +                { 
 +····················Write-Host "$file => $newName"
-················$fullName = [WinSCP.RemotePath]::Combine($remotePath, $file.replace("[", "[[]")) +····················$fullName = [WinSCP.RemotePath]::Combine($remotePath, $file.replace("[", "[[]")) 
- ···············$fullNewName = [WinSCP.RemotePath]::Combine($remotePath, $newName) + ···················$fullNewName = [WinSCP.RemotePath]::Combine($remotePath, $newName) 
- ···············$session.MoveFile($fullName, $fullNewName)+ ···················$session.MoveFile($fullName, $fullNewName) 
 +                }
            }             }
        }         }

Last modified: by martin