Menu  Toggle search  [ ![](https://winscp-
static-746341.c.cdn77.org/assets/images/logos/logo.png?v=7032) WinSCP  Free
SFTP, SCP, S3 and FTP client  for  Windows  ](https://winscp.net/)

  * [ Home ](/eng/index.php)
  * [ News ](/eng/news.php)
  * [ Introduction ](/eng/docs/introduction)
  * [ Download ](/eng/download.php)
  * [ Install ](/eng/docs/guide_install)
  * [ Documentation ](/eng/docs/)
  * [ Forum ](/forum/)

Close

Search

Close

[ Documentation ](/eng/docs/start "Documentation") » [ Features
](/eng/docs/feature_index "Features") » [ Scripting ](/eng/docs/scripting
"Scripting") » [ Script Commands ](/eng/docs/scripting#commands "Script
Commands") »

#  put command

[ Uploads ](/eng/docs/task_upload) one or more files from local directory to
remote directory.

  * Syntax 
  * Remarks 
  * Examples 
  * Converting to .NET Assembly 

_Advertisement_

##  Syntax

    
    
    put <file> [ [ <file2> ... ] <directory>/[ <newname> ] ]
    

##  Remarks

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 wildcard  1  to
select multiple files. To upload all files in a directory, use mask ` * ` .

The last parameter specifies target remote directory and optionally [
operation mask ](/eng/docs/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.

With the [ ` /stdin ` command-line switch ](/eng/docs/commandline#stdin) , ` -
` can be used as a source to stream the [ standard input of ` winscp.com `
](/eng/docs/executables#redirection) to remote server. Streaming is supported
with the [ SFTP ](/eng/docs/sftp) and [ FTP ](/eng/docs/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 ](/eng/docs/scriptcommand_option#failonnomatch) `
command).

You can have WinSCP [ generate a code template
](/eng/docs/guide_automation#generating) for ` put ` for you.

See also ` [ synchronize ](/eng/docs/scriptcommand_synchronize) ` , if you
need to transfer modified files only.

Switches:

Switch  |  Description   
---|---  
` -delete ` |  Delete source local file(s) after a successful transfer.   
` -latest ` |  Uploads the latest file from the files selected by the ` file ` , ` file2 ` … parameters (typically [ file masks ](/eng/docs/file_mask) ) only.   
` -resume ` |  Automatically resume transfer if possible.  2    
[ SFTP ](/eng/docs/sftp) and [ FTP ](/eng/docs/ftp) protocols only. Cannot be
combined with ` -append  ` . Has no effect when streaming ( ` - ` source).  
` -append ` |  Append source file to the end of target file.   
[ SFTP protocol ](/eng/docs/sftp) only. Cannot be combined with ` -resume  ` .  
` -preservetime ` |  Preserve timestamp.   
` -nopreservetime ` |  Do not preserve timestamp.   
` -permissions=<mode> ` |  Set permissions ( [ SFTP ](/eng/docs/sftp) and [ SCP ](/eng/docs/scp) protocols only).   
Has no effect when streaming ( ` - ` source).  
` -nopermissions ` |  Keep default permissions.   
` -speed=<kbps> ` |  Limit transfer speed (in KB/s).   
` -transfer=<mode> ` |  ` binary|ascii|automatic `   
[ Transfer mode ](/eng/docs/transfer_mode) : binary, ascii (text), automatic
(by extension).  
` -filemask=<mask> ` |  ` <mask>[;<mask2>...] `   
Sets [ file mask ](/eng/docs/file_mask) .  
` -resumesupport=<state> ` |  ` on|off|<threshold> `   
Configures [ automatic resume/transfer to temporary filename
](/eng/docs/resume#automatic) .  
` -neweronly ` |  Transfer new and updated files only. See also ` [ synchronize ](/eng/docs/scriptcommand_synchronize) ` command.   
` -rawtransfersettings  setting1=value1  setting2=value2