Differences

This shows you the differences between the selected revisions of the page.

scriptcommand_put 2019-11-11 scriptcommand_put 2024-10-26 (current)
Line 1: Line 1:
-====== put ======+====== put command ======
[[task_upload|Uploads]] one or more files from local directory to remote directory. [[task_upload|Uploads]] one or more files from local directory to remote directory.
-__====== Underlined Text ====== +===== Syntax =====
-__===== Syntax =====+
  put <file> [ [ <file2> ... ] <directory>/[ <newname> ] ]   put <file> [ [ <file2> ... ] <directory>/[ <newname> ] ]
Line 11: Line 10:
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 ((The Windows wildcard supports ''*'' and ''?'' only. If you want to use a full syntax of [[file_mask|file masks]], use a ''[[#filemask|-filemask]]'' switch.)) to select multiple files. To upload all files in a directory, use mask ''*''. 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 ((The Windows wildcard supports ''*'' and ''?'' only. If you want to use a full syntax of [[file_mask|file masks]], use a ''[[#filemask|-filemask]]'' switch.)) to select multiple files. To upload all files in a directory, use mask ''*''.
-The last parameter specifies target remote directory and optionally [[operation_mask|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. +The last parameter specifies ==target== remote directory and optionally [[operation_mask|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 [[commandline#stdin|''/stdin'' command-line switch]], ''-'' can be used as a source to ==stream== the [[executables#redirection|standard input of ''winscp.com'']] to remote server. Streaming is supported with the [[sftp|SFTP]] and [[ftp|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 ''[[scriptcommand_option#failonnomatch|option failonnomatch on]]'' command). 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 ''[[scriptcommand_option#failonnomatch|option failonnomatch on]]'' command).
-You can have WinSCP [[ui_generateurl|generate a code template]] for ''put'' for you.+You can have WinSCP [[guide_automation#generating|generate a code template]] for ''put'' for you.
See also ''[[scriptcommand_synchronize|synchronize]]'', if you need to transfer modified files only. See also ''[[scriptcommand_synchronize|synchronize]]'', if you need to transfer modified files only.
Line 23: Line 24:
| ''-==delete==''              | Delete source local file(s) after a successful transfer. | | ''-==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_mask|file masks]]) only. | | ''-==latest==''              | Uploads the latest file from the files selected by the ''file'', ''file2'' ... parameters (typically [[file_mask|file masks]]) only. |
-| ''-==resume==''              | Automatically resume transfer if possible·((Applies for individual files transfers only. It does not skip transfer of fully transferred files. For that, combine the switch with ''[[#neweronly|-neweronly]]''.)) ([[SFTP]] and [[FTP]] protocols only). Cannot be combined with ''[[#append|-append]]''. | +| ''-==resume==''              | Automatically resume transfer if possible.((Applies for individual files transfers only. It does not skip transfer of fully transferred files. For that, combine the switch with ''[[#neweronly|-neweronly]]''.)) \\ [[SFTP]] and [[FTP]] protocols only. Cannot be combined with ''[[#append|-append]]''. Has no effect when streaming (''-'' source). | 
-| ''-==append==''              | Append source file to the end of target file ([[sftp|SFTP protocol]] only). Cannot be combined with ''[[#resume|-resume]]''. |+| ''-==append==''              | Append source file to the end of target file. \\ [[sftp|SFTP protocol]] only. Cannot be combined with ''[[#resume|-resume]]''. |
| ''-==preservetime==''        | Preserve timestamp. | | ''-==preservetime==''        | Preserve timestamp. |
| ''-==nopreservetime==''      | Do not preserve timestamp. | | ''-==nopreservetime==''      | Do not preserve timestamp. |
-| ''-==permissions===<mode>''  | Set permissions ([[SFTP]] and [[SCP]] protocols only). |+| ''-==permissions===<mode>''  | Set permissions ([[SFTP]] and [[SCP]] protocols only). \\ Has no effect when streaming (''-'' source). |
| ''-==nopermissions==''      | Keep default permissions. | | ''-==nopermissions==''      | Keep default permissions. |
| ''-==speed===<kbps>''        | Limit transfer speed (in KB/s). | | ''-==speed===<kbps>''        | Limit transfer speed (in KB/s). |
Line 70: Line 71:
^ Switch                  ^ Mapping ^ ^ Switch                  ^ Mapping ^
| ''-delete''              | Value ''true'' (''$True'' in PowerShell) for method parameter ''remove''. | | ''-delete''              | Value ''true'' (''$True'' in PowerShell) for method parameter ''remove''. |
-| ''-latest''              | See [[script_upload_most_recent_file|Uploading the most recent file]]. |+| ''-latest''              | See [[script_upload_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''. | | ''-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. | | ''-neweronly''          | Not supported. Use ''[[library_session_synchronizedirectories|Session.SynchronizeDirectories]]'' instead. |

Last modified: by 194.165.156.202