Script ftp connection does not work

Advertisement

Inne
Joined:
Posts:
2
Location:
Belgium

Script ftp connection does not work

The following code does not work, escpecially the Winscp.exe-command (which I excluded once to test and then the files were locally copied from tempfolder right to the myfolder).

What does work:
if I use winscp (or filezila or ...) myself and connect to the ipadress with my user and pw it does work and I can copy the files manually or syncronise them. But the instant I use scripting, it doesn't work. I tried without winscp before, same issue... Has someone a clue what it might be?
Not even the logfile give anything: empty. Even if I couldn't connect it would say something right?
Thanks a lot!

@echo 
set TMPPATH="C:\temp\cvstemp"
mkdir "%TMPPATH%"
winscp.exe /console /log="C:\myfolder\winscp.log" /command 
    "open ftp://user:pw@ipadress/" ^
    "get -delete ""IN/*"" ""%TMPPATH%""" ^
    "exit"
for /r "%TMPPATH%" %%f in ("*.*") do move "%%f" "C:\myfolder\"
rd /s /q "%TMPPATH%"

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: Script ftp connection does not work

Use winscp.com instead of winscp.exe and show us its output.

Reply with quote

Inne
Joined:
Posts:
2
Location:
Belgium

Thanks a lot for your answer. I've used rapidee.exe to change the startup parameters of the cmd and it worked with the following code, because I wanted the files and not the content of the file.

winscp.exe /console /log="C:\temp\winscp.log"  /command "option reconnecttime 120" "open ftp://user:pw@xx.xx.xxx.xxx/" "get -delete ""/IN/*"" C:\temp\" "exit"

I still have some problem with the connection: Script blocks sometimes (with the ftp startup conversation).
2018-06-12 12:16:56.198 Connecting to xx.xx.xxx.xxx ...
. 2018-06-12 12:16:56.214 Connected with xx.xx.xxx.xxx  Waiting for welcome message...
< 2018-06-12 12:16:56.245 220 Microsoft FTP Service
> 2018-06-12 12:16:56.245 USER user
< 2018-06-12 12:16:56.261 331 Password required
> 2018-06-12 12:16:56.261 PASS ***************
< 2018-06-12 12:16:56.276 230 User logged in.
> 2018-06-12 12:16:56.276 SYST
. 2018-06-12 12:16:56.292 The server is probably running Windows, assuming that directory listing timestamps are affected by DST.
< 2018-06-12 12:16:56.292 215 Windows_NT
> 2018-06-12 12:16:56.292 FEAT
< 2018-06-12 12:16:56.308 211-Extended features supported:
< 2018-06-12 12:16:56.339  LANG EN*
< 2018-06-12 12:16:56.339  UTF8
< 2018-06-12 12:16:56.339  AUTH TLS;TLS-C;SSL;TLS-P;
< 2018-06-12 12:16:56.339  PBSZ
< 2018-06-12 12:16:56.339  PROT C;P;
< 2018-06-12 12:16:56.339  CCC
< 2018-06-12 12:16:56.339  HOST
< 2018-06-12 12:16:56.339  SIZE
< 2018-06-12 12:16:56.339  MDTM
< 2018-06-12 12:16:56.339  REST STREAM
< 2018-06-12 12:16:56.339 211 END
> 2018-06-12 12:16:56.339 OPTS UTF8 ON
< 2018-06-12 12:16:56.339 200 OPTS UTF8 command successful - UTF8 encoding now ON.
. 2018-06-12 12:16:56.339 Connected
. 2018-06-12 12:16:56.339 --------------------------------------------------------------------------
. 2018-06-12 12:16:56.339 Using FTP protocol.
. 2018-06-12 12:16:56.339 Doing startup conversation with host.
> 2018-06-12 12:16:56.339 PWD
. 2018-06-12 12:17:11.190 Timeout detected. (control connection)

I suspect the problem lays with the FTP-server which isn't in my control. So I've send them an email. Did you ever encounter something like this? That the start up conversation sometimes get stuck?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum