Differences
This shows you the differences between the selected revisions of the page.
2017-09-02 | 2017-09-02 | ||
no summary (2.146.8.129) (hidden) (untrusted) | no summary (2.146.8.129) (hidden) (untrusted) | ||
Line 8: | Line 8: | ||
- | ===== [[net]] Converting to .NET Assembly ===== | ||
- | When [[library_from_script|converting script to .NET Assembly]], map ''put'' command to ''[[library_session_putfiles|Session.PutFiles]]'' method. | ||
- | |||
- | Parameters mapping: Command parameter ''file'' maps to method parameter ''localPath''. When multiple source file parameters are used, you need to call ''Session.PutFiles'' multiple times. Command parameter ''directory/newname'' maps to method parameter ''remotePath''. You have to [[library_from_script#paths|convert relative paths to absolute paths]]. | ||
- | |||
- | Switches mapping: | ||
- | ^ Switch ^ Mapping ^ | ||
- | | ''-delete'' | Value ''true'' (''$True'' in PowerShell) for method parameter ''remove''. | | ||
- | | ''-latest'' | See [[script_upload_most_recent_file|Uploading the most recent file]]. | | ||
- | | ''-resume'' \\ ''-append'' \\ ''-preservetime'' \\ ''-nopreservetime'' \\ ''-permissions'' \\ ''-nopermissions'' \\ ''-transfer'' \\ ''-filemask'' \\ ''-resumesupport'' \\ ''-speed=<kbps>'' | [[library_from_script_transfer_settings|Converting transfer settings scripting switches]] to .NET assembly class ''TransferSettings''. | | ||
- | | ''-neweronly'' | Not supported. Use ''[[library_session_synchronizedirectories|Session.SynchronizeDirectories]]'' instead. | | ||
- | |||
- | To emulate the ([[scripting#using_scripting|default]]) ''[[scriptcommand_option#batch|option batch abort]]'' mode, call ''[[library_operationresultbase|TransferOperationResult.Check]]'' on method's result. See also [[library_session#results|Capturing results of operations]]. | ||
- | |||
- | For example, following script snippet: | ||
- | |||
- | <code winscp> | ||
- | cd /home/martinp | ||
- | lcd d:\ | ||
- | ... | ||
- | put -delete -filemask=*>1M -resumesupport=off *.txt *.xml web/ | ||
- | </code> | ||
- | |||
- | maps to following [[library_powershell|PowerShell]] code: | ||
- | |||
- | <code powershell> | ||
- | $transferOptions = New-Object WinSCP.TransferOptions | ||
- | # -filemask=*>1M | ||
- | $transferOptions.FileMask = "*>1M" | ||
- | # -resumesupport=off | ||
- | $transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off | ||
- | # Absolute paths + $True for -delete + Two calls for two source parameters | ||
- | # + calling Check on result to emulate the (default) "option batch abort" mode | ||
- | $session.PutFiles("d:\*.txt", "/home/martinp/web/", $True, $transferOptions).Check() | ||
- | $session.PutFiles("d:\*.xml", "/home/martinp/web/", $True, $transferOptions).Check() | ||
- | </code> | ||