- martin
Post a reply
Topic review
- DaMatt
Thank you, works like a charm!
Can you give me a hint how I start an other .cmd file if the result ist success (move and rename).
Thanks
Can you give me a hint how I start an other .cmd file if the result ist success (move and rename).
Thanks
- martin
Re: Upload in batch shouldn't overwrite file on server
If you want the script to upload only files that do not exist yet in the remote folder (in any version, any size, any timestamp) on the server, use:
See https://winscp.net/eng/docs/scriptcommand_synchronize
synchronize remote -filemask=Test.txt -criteria=none
See https://winscp.net/eng/docs/scriptcommand_synchronize
- DaMatt
Upload in batch shouldn't overwrite file on server
Hello to the forum.
I have (II think) a quite simple task to perform but I'm stuck.
I created a script out of the GUI but the batch keeps overwriting the existing file on the server. I tried
Script:
I have (II think) a quite simple task to perform but I'm stuck.
- I want to transfer via batch and task a textfile with time-bookings to a server, where they are processed by a task and then the file will be removed from the server. Therefore my upload batch should not overwrite the file on the server until the file is processed and removed from the server.
- (not startet because of 1.) When successful transferred, the file should be locally moved to an oder folder and renamed.
I created a script out of the GUI but the batch keeps overwriting the existing file on the server. I tried
option batch on
, option batch abort
, in Preferences "No confirmations for background transfers" is not activated. Please help! Thx
Script:
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Zeiterfassungfiles\FTP_Log\WinSCP_Test.log" /ini=nul ^
/command ^
"option batch abort" ^
"open sftp://xxx" ^
"lcd C:\Zeiterfassungfiles" ^
"cd /sftp/ZEIT" ^
"put Test.txt" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%