Session.Getfiles when removal set to $true
Using Powershell 3.0
Using .NET Assembly 5.9
Any ideas why after the script process $Session.getfiles($remotepath, $localpath, $true, $transferOptions)
it's trying to delete the directory? I had thought it would only do this for "files" not directories. Is there anyway to only delete files after transfer and leave directory structure on the remote side? I looked at Session.SyncronizeDirectory method but that appears to put me in the same boat, maybe
Here's just a clip of the code. It works fine on another sftp server as I expect (doesn't try to delete the directory)
VERBOSE: Error: Error deleting file '/test/script/file'.
Permission denied.
Error code: 3
Error message from server (en-US): Permission denied
I also looked at batch mode emulation, but not sure how to change the default from abort mode to continue, this may help me workaround it for now.
Thanks for the assistance
Using .NET Assembly 5.9
Any ideas why after the script process $Session.getfiles($remotepath, $localpath, $true, $transferOptions)
it's trying to delete the directory? I had thought it would only do this for "files" not directories. Is there anyway to only delete files after transfer and leave directory structure on the remote side? I looked at Session.SyncronizeDirectory method but that appears to put me in the same boat, maybe
Here's just a clip of the code. It works fine on another sftp server as I expect (doesn't try to delete the directory)
$transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary $transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off $transferOptions.FileMask = "*.*|.no_delete,*.part,*.tmp" $transferResult = $session.GetFiles($remotePath, $localPath, $True, $transferOptions) $transferResult.Check()
VERBOSE: Error: Error deleting file '/test/script/file'.
Permission denied.
Error code: 3
Error message from server (en-US): Permission denied
I also looked at batch mode emulation, but not sure how to change the default from abort mode to continue, this may help me workaround it for now.
Thanks for the assistance