Option Confirm Off does not work in a script.

Advertisement

mattw@...
Guest

Option Confirm Off does not work in a script.

This is my WinSCP script that I run from a batch file. *'s hide sensitive info. If the file Data_ADT.txt does not exist in the remote directory, it works just fine.
open sftp://***:***@mft.***.org/
option batch on
option confirm off
put "H:\BB Data\SM Data\4DBKF_***_DevTest2_2023-08-20 0000\temporary files\***_20240110111104\Data_ADT.txt" -nopreservetime "SFTP/***/***_QA-Testing/TEST/ADT/"
exit
These lines are in the logfile just before the put command:
< 2024-01-10 11:11:07.871 Script: Session started.
< 2024-01-10 11:11:07.871 Script: Active session: [1] Eldermark_sa@mft.conniect.org
> 2024-01-10 11:11:07.871 Script: option batch on
< 2024-01-10 11:11:07.871 Script: batch           on        
> 2024-01-10 11:11:07.871 Script: option confirm off
< 2024-01-10 11:11:07.871 Script: confirm         off  
and here are the error lines
* 2024-01-10 11:11:08.399 (ETerminal) General failure (server should provide error description).
* 2024-01-10 11:11:08.399 Error code: 4
* 2024-01-10 11:11:08.399 Error message from server: Server error.
* 2024-01-10 11:11:08.399 
* 2024-01-10 11:11:08.399 Common reasons for the Error code 4 are:
* 2024-01-10 11:11:08.399 - Renaming a file to a name of already existing file.
* 2024-01-10 11:11:08.399 - Creating a directory that already exists.
* 2024-01-10 11:11:08.399 - Moving a remote file to a different filesystem (HDD).
* 2024-01-10 11:11:08.399 - Uploading a file to a full filesystem (HDD).
* 2024-01-10 11:11:08.399 - Exceeding a user disk quota.
. 2024-01-10 11:11:08.399 Asking user:
. 2024-01-10 11:11:08.399 Cannot overwrite remote file '/SFTP/***/***_QA-Testing/TEST/ADT/Data_ADT.txt'.$$
. 2024-01-10 11:11:08.399  
. 2024-01-10 11:11:08.399 Press 'Delete' to delete the file and create new one instead of overwriting it.$$ ("General failure (server should provide error description).
Tried it with and without the batch on command. Docs say that batch on should also turn off the confirmation. Also tried the option commands before the open, did not work again. Has anyone else run into this or can point me to what is wrong?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,864
Location:
Prague, Czechia

Re: Option Confirm Off does not work in a script.

I do not think there's any confirmation.
The file simply cannot be overwritten.
If you have permissions to delete it (but not overwrite it), you might need to use rm command before put.

Reply with quote

Advertisement

You can post new topics in this forum