Converting Transfer Settings Scripting Switches to Code Based on .NET Assembly

When converting script to .NET Assembly, map transfer settings switches on file transfer scripting commands (get, put and synchronize) as follows:

Switch Mapping
-preservetime This is default.
To set it explicitly, set TransferOptions.PreserveTimestamp to true ($True in PowerShell).
-nopreservetime Set TransferOptions.PreserveTimestamp to false ($False).
-permissions Create new instance of FilePermissions and set FilePermissions.Octal to a value of the switch. Assign instance of FilePermissions to TransferOptions.FilePermissions.
-nopermissions This is default.
To set it explicitly, set TransferOptions.FilePermissions to null ($Null).
-transfer Set TransferOptions.TransferMode. Use TransferMode.Binary for binary, TransferMode.Ascii for ascii and TransferMode.Automatic for automatic.
Enumeration syntax in PowerShell is like [WinSCP.TransferMode]::Binary.
-filemask Set TransferOptions.FileMask. Value syntax is identical.
-resumesupport Set TransferOptions.ResumeSupport. For on and off set TransferOptions.ResumeSupport.State to TransferResumeSupportState.On and TransferResumeSupportState.Off respectivelly. When threshold is used, set TransferOptions.ResumeSupport.State to TransferResumeSupportState.Smart and TransferOptions.ResumeSupport.Threshold to the threshold value.
Enumeration syntax in PowerShell is like [WinSCP.TransferResumeSupportState]::On.

Note that not all script commands (and .NET assembly methods respectively) make use of all the switches. Refer to respective command documentation for valid switches.

 
  library_from_script_transfer_settings.txt · Last modified: by prikryl
 

Search Documentation

This page

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

Associations

Site design by Black Gate