You cannot do that in scripting. But you can explicitly remove the file before the upload using the
https://winscp.net/eng/docs/scriptcommand_rm
rm
command.
https://winscp.net/eng/docs/scriptcommand_rm
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
rm
command.
/command " option batch continue" "open sftp://######:######@######//" "put ""C:\##########\*"" ""/##########/""" "exit"
. 2021-06-09 14:05:39.856 File: 'C:\#######\Log_201804_001.xls' [2020-06-22T12:51:39.850Z] [53248]
. 2021-06-09 14:05:39.858 Copying "C:\#######\Log_201804_001.xls" to remote directory started.
. 2021-06-09 14:05:39.858 Binary transfer mode selected.
. 2021-06-09 14:05:39.858 Opening remote file.
> 2021-06-09 14:05:39.858 Type: SSH_FXP_OPEN, Size: 71, Number: 11011
< 2021-06-09 14:05:39.936 Type: SSH_FXP_STATUS, Size: 36, Number: 11011
< 2021-06-09 14:05:39.936 Status code: 3, Message: 11011, Server: Permission denied, Language: en
> 2021-06-09 14:05:39.937 Type: SSH_FXP_LSTAT, Size: 55, Number: 11271
< 2021-06-09 14:05:39.977 Type: SSH_FXP_ATTRS, Size: 37, Number: 11271
* 2021-06-09 14:05:39.978 (ETerminal) Permission denied.
* 2021-06-09 14:05:39.978 Error code: 3
* 2021-06-09 14:05:39.978 Error message from server (en): Permission denied
. 2021-06-09 14:05:39.978 Asking user:
. 2021-06-09 14:05:39.978 Cannot overwrite remote file '/########/Log_201804_001.xls'.$$
. 2021-06-09 14:05:39.978
. 2021-06-09 14:05:39.978 Press 'Delete' to delete the file and create new one instead of overwriting it.$$ ("Permission denied.
. 2021-06-09 14:05:39.978 Error code: 3
. 2021-06-09 14:05:39.978 Error message from server (en): Permission denied")
< 2021-06-09 14:05:39.978 Script: Cannot overwrite remote file '/#######/Log_201804_001.xls'.
< 2021-06-09 14:05:39.978 Script: Permission denied.
< 2021-06-09 14:05:39.978 Error code: 3
< 2021-06-09 14:05:39.978 Error message from server (en): Permission denied
* 2021-06-09 14:05:39.979 (ESkipFile) Cannot overwrite remote file '/######/Log_201804_001.xls'.$$
* 2021-06-09 14:05:39.979
* 2021-06-09 14:05:39.979 Press 'Delete' to delete the file and create new one instead of overwriting it.$$
* 2021-06-09 14:05:39.979 Permission denied.
* 2021-06-09 14:05:39.979 Error code: 3
* 2021-06-09 14:05:39.979 Error message from server (en): Permission denied