Uploads one or more files from local directory to remote directory.
put <file> [ [ <file2> ... ] <directory>/[ <newname> ] ]
If only one parameter is specified, uploads the file to remote working directory. If more parameters are specified, all except the last one specify set of files to upload. Filename can be replaced with Windows wildcard1 to select multiple files. To upload all files in a directory, use mask
The last parameter specifies target remote directory and optionally operation mask to store file(s) under different name. Target directory must end with slash. To upload more files to current working directory use
./ as the last parameter.
/stdin command-line switch,
- can be used as a source to stream the standard input of
winscp.com to remote server. Streaming is supported with the SFTP and FTP protocols only.
When specific file name is used, command fails when the file does not exist. When wildcard is used, command succeeds, without doing anything, if the wildcard does not match any file, by default (you can change this using
option failonnomatch on command).
You can have WinSCP generate a code template for
put for you.
synchronize, if you need to transfer modified files only.
||Delete source local file(s) after a successful transfer.|
||Uploads the latest file from the files selected by the
||Automatically resume transfer if possible.2
SFTP and FTP protocols only. Cannot be combined with
||Append source file to the end of target file.
SFTP protocol only. Cannot be combined with
||Do not preserve timestamp.|
||Set permissions (SFTP and SCP protocols only).
Has no effect when streaming (
||Keep default permissions.|
||Limit transfer speed (in KB/s).|
Transfer mode: binary, ascii (text), automatic (by extension).
Sets file mask.
Configures automatic resume/transfer to temporary filename.
||Transfer new and updated files only. See also
||Allows configuring any transfer settings using raw format as in an INI file. E.g. to enable preserving of directory timestamps, use
XML log elements:
put -delete index.html about.html ./
put -permissions=644 index.html about.html /home/martin/public_html/
put d:\www\index.html about.*
put *.html *.png /home/martin/backup/*.bak
put -filemask=*.html -resumesupport=on *
Converting to .NET Assembly
When converting script to .NET Assembly, map
put command to
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 convert relative paths to absolute paths.
||See Uploading the most recent file.|
||Converting transfer settings scripting switches to .NET assembly class
||Not supported. Use
To emulate the (default)
option batch abort mode, call
TransferOperationResult.Check on method’s result. See also Capturing results of operations.
For example, following script snippet:
cd /home/martinp lcd d:\ ... put -delete -filemask=*>1M -resumesupport=off *.txt *.xml web/
maps to following PowerShell code:
$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()
- The Windows wildcard supports
?only. If you want to use a full syntax of file masks, use a
- Applies for individual files transfers only. It does not skip transfer of fully transferred files. For that, combine the switch with