Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: WinSCP batch - file transfer happens sometimes only

kiran teki wrote:

I have a last query 'Can we rotate the logs based on size/date ?'

You can use /logsize command-line switch:
https://winscp.net/eng/docs/commandline#logging
kiran teki

Re: WinSCP batch - file transfer happens sometimes only

martin wrote:

You are starting WinSCP with C:\Windows\system32 as the startup/working directory and you try to upload files *.csv from there. It's no surprise that there are no such files.


. 2019-11-27 14:55:00.142 Working directory: C:\Windows\system32
...
> 2019-11-27 15:00:02.366 Script: put *.csv
< 2019-11-27 15:00:02.366 Script: No file matching '*.csv' found.

Either set the startup directory to the folder where you files are; or use lcd command before put to change the working directory to that folder. Or use a full source path in the put command.


Perfect it worked well after I gave the full path in PUT command , now transferring the files automatically without any issue. I have a last query 'Can we rotate the logs based on size/date ?'

Thanks,
Kiran Teki.
martin

Re: WinSCP batch - file transfer happens sometimes only

You are starting WinSCP with C:\Windows\system32 as the startup/working directory and you try to upload files *.csv from there. It's no surprise that there are no such files.


. 2019-11-27 14:55:00.142 Working directory: C:\Windows\system32
...
> 2019-11-27 15:00:02.366 Script: put *.csv
< 2019-11-27 15:00:02.366 Script: No file matching '*.csv' found.

Either set the startup directory to the folder where you files are; or use lcd command before put to change the working directory to that folder. Or use a full source path in the put command.
kiran teki

Re: WinSCP batch - file transfer happens sometimes only

martin wrote:

kiran teki wrote:

Bottom line is manual trigger working properly but not automated one
Please help us out on this.

Again, post a log file please.


Please find the logs herewith.
martin

Re: WinSCP batch - file transfer happens sometimes only

kiran teki wrote:

Bottom line is manual trigger working properly but not automated one
Please help us out on this.

Again, post a log file please.
kiran teki

Re: WinSCP batch - file transfer happens sometimes only

::::Update:::::
No issue with script, destination server receives file properly, we received update from that team that they run other back end job for every 1 minute to moves these file to other location immediately.
Now we auto triggered this script with windows task scheduler then another issue comes into picture, batch job triggering properly as per log data but not transferring the files.

Bottom line is manual trigger working properly but not automated one
Please help us out on this.


Thanks,
Kiran Teki.
kiran teki

Re: WinSCP batch - file transfer happens sometimes only

martin wrote:

Please attach a full session log file showing the problem (using the latest version of WinSCP). Please include a log file both from a successful and a failed session.


Great to see your reply. Come to the issue we are using latest WinSCP 5.15.5(Build 9925) version. And I attached latest log please have a look.

Thanks,
Kiran Teki.
martin

Re: WinSCP batch - file transfer happens sometimes only

Please attach a full session log file showing the problem (using the latest version of WinSCP). Please include a log file both from a successful and a failed session.
kiran teki

WinSCP batch - file transfer happens sometimes only

My requirement is
>> sftp files from source to destination
>> move files to backup location in source itself

So I have installed WinSCP and its working properly. Based on this I generated the batch script which is also executing without error but file transfer happens sometime only. Surprising GUI is working as expected but this is not, What could be the issue ? Need urgent fix would be much appreciated as nearing delivery deadlines.
@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\sftp\logs\sftp_log.log" /ini=nul ^
  /command ^
    "open sftp://xxxxxxxxx/ -hostkey=""ssh-ed25519 256 d7Te2DHmvBNSWJNBWik2KbDTjmWtYHe2bvXTMM9lVg4=""" ^
    "cd /IN" ^
    "put *.*" ^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%