ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Post here if you experience file transfer problems or unexpected errors.
Hi.
I keep getting the message SYNC Error #4: Operation timed out. when syncing from an external server to my local HD. The log just before the connection was closed down, is as follow:
MDTM testmouse.htm
213 20051104093002
Remote file time: 11/04/2005 09:30:02
Adjusted remote file time: 11/04/2005 10:53:20
Local file time: 01/13/2009 17:34:03
Skipping (local file is up to date) 73mod/testmouse.htm
CWD ..
250 CWD command successful
PWD
257 "/sagaforumet.com" is the current directory
CWD OT
250 CWD command successful
PWD
257 "/sagaforumet.com/OT" is the current directory
PASV
227 Entering Passive Mode (83,143,81,38,175,167).
Opening data connection to 83.143.81.38 Port: 44967
LIST
Connection failed as the connected part didn’t answer correct after a time period,
or the established connection failed because the connected host didn’t answer.
Timeout (30s).
Timeout
Client closed the connection.
***** SYNC Error #4: Operation timed out.
CLOSEHOST
***** CLOSEHOST Error #12001: Not connected.
I tried to change the SYNC-command to
Code: Select all:syncstart IF(SYNC($local_dir,$remote_dir,DOWNLOAD,SUBDIRS)!="OK")  PRINT("Synchronization error. Exiting")  GOTO :syncstart END IF
but then the IF-loop went on for ever.

Lars H. :(
Hi Lars,

Try putting SETPASSIVE(DISABLED) on the top of your script
Hi.

That didn't help at all, even with my firewall turned off. I think the remote ftp-server don't like active-mode.
SETPORT("21")
Setting TCP port to 21.

OPENHOST("ftp.xxxxxxxx.com","xxxxxxxx",******)
Connecting to ftp.xxxxxxxx.com
Resolving host name "ftp.xxxxxxxx.com"
Connecting to 83.143.81.38 Port: 21
Connected to ftp.xxxxxxxx.com.
220 ProFTPD 1.3.1 Server (Main FTP Server) [83.143.81.38]
USER xxxxxxxx
331 Password required for xxxxxxxx
PASS ********
230 User xxxxxxxx logged in
SYST
215 UNIX Type: L8
FEAT
211-Features:
MDTM
REST STREAM
SIZE
211 End
PWD
257 "/" is the current directory
Connected.

SETPASSIVE(DISABLED)
Disabling passive mode.

ADDEXCLUSION(DOWNLOAD,"phpBB2/")
Adding "phpBB2/" to the download exclusion list.

ADDEXCLUSION(DOWNLOAD,"cgi-bin/")
Adding "cgi-bin/" to the download exclusion list.

SYNC("Z:\sagaforumet","sagaforumet.com/",DOWNLOAD,SUBDIRS)
CWD sagaforumet.com/
250 CWD command successful
PWD
257 "/sagaforumet.com" is the current directory
Uploading temporary file to calculate server-client clock time difference.
TYPE I
200 Type set to I
PORT 192,168,1,2,17,18
200 PORT command successful
STOR ScF129.tmp
150 Opening BINARY mode data connection for ScF129.tmp
74 bytes transferred. (4,81 kB/s) (15 ms)
226 Transfer complete
MDTM ScF129.tmp
213 20090115115816
Remote Time: 01/15/2009 11:58:16
Remote Time: 01/15/2009 13:21:48
DELE ScF129.tmp
250 DELE command successful
Clock time difference is -5012 seconds.
Synchronizing local directory Z:\sagaforumet from sagaforumet.com/.
PORT 192,168,1,2,17,19
200 PORT command successful
LIST
150 Opening ASCII mode data connection for file list
9156 bytes transferred. (40,8 kB/s) (219 ms)
226 Transfer complete
Downloading (local file not found) 385.jpg
SIZE 385.jpg
213 89751
PORT 192,168,1,2,17,20
200 PORT command successful
RETR 385.jpg
425 Unable to build data connection: Cannot assign requested address
***** SYNC Error #425: Cannot download remote file 385.jpg.
***** The server said: Unable to build data connection: Cannot assign requested address
CWD /
250 CWD command successful
PWD
257 "/" is the current directory
CLOSEHOST
QUIT
221 Goodbye.
Client closed the connection.
Disconnected.
I download the same files with FireFTP, and had similar problems with active-mode, but not passive.

Lars H.
Hi Lars,
I download the same files with FireFTP, and had similar problems with active-mode, but not passive.
Ok. that helps. Does ScriptFTP always fails when passive is used or only sometimes? Could you send me the log of a FireFTP session? (only from PASV onwards, the rest of the output does not matter)
Hi.

I'm not sure what you want, but could this be it? I only transferred two files.
220 ProFTPD 1.3.1 Server (Main FTP Server) [83.143.81.38]
USER xxxxxxxx
331 Password required for xxxxxxxx
PASS (password not shown)
230 User xxxxxxxx logged in
FEAT
211-Features:
MDTM
REST STREAM
SIZE
211 End
PWD
257 "/" is the current directory
TYPE A
200 Type set to A
CWD /sagaforumet.com/baatmagasinet
250 CWD command successful
PASV
227 Entering Passive Mode (83,143,81,38,136,84).
LIST -al
150 Opening ASCII mode data connection for file list
226 Transfer complete
CWD /sagaforumet.com/batmessen_2007
250 CWD command successful
PASV
227 Entering Passive Mode (83,143,81,38,136,196).
LIST -al
150 Opening ASCII mode data connection for file list
226 Transfer complete
TYPE I
200 Type set to I
PASV
227 Entering Passive Mode (83,143,81,38,137,7).
RETR sagastand-09.jpg
150 Opening BINARY mode data connection for sagastand-09.jpg (70782 bytes)
226 Transfer complete
PASV
227 Entering Passive Mode (83,143,81,38,137,31).
RETR sagastand-12.jpg
150 Opening BINARY mode data connection for sagastand-12.jpg (53327 bytes)
226 Transfer complete
Lars H.
Hi Lars,

Would you mind If I test for myself the FTP server? I need a temporary user account to do some tests. Please, contact me by email.
Hi.

OK, I'll send you a mail with login credentials.

Lars H.
Hi Lars,

I tried the following:
Code: Select allSYNC("D:\test","/",DOWNLOAD,SUBDIRS)
And downloaded many files (probably hundreds) without any errors at all. It's important to know if your error happens always or only sometimes. Please, let me know. This way we can know if your router, firewall or anything else is blocking some ports. Note that each time a file is transfered, the FTP client opens a new connection at the FTP server (not the usual FTP port #21), and the port number is different each time. This is the reason FireFTP worked and ScriptFTP not.

Check also that ScriptFTP is authorized in the windows firewall (see the control panel)
Hi.

The problem occur almost every time I run the script. But now and then it runs OK. I tried to set ScriptFTP to always be allowed in my firewall (Trend Micro). No help. I disabled both the Trend Micro firewall and the firewall in my 3COM router, still problems. (I never use the built in firewall in Windows). I'm testing with SYNC'ing from the external host containing 163MB, 1633 files and 156 folders. The script fails typical after downloading 20 - 50MB, 200 - 1000files and 10 - 10 folders when the local directory is empty when I started the script (every file has to be downloaded). When the local and remote directories are filled with identical files and every file is skipped, no error occur. Here a typical log when failing.
PASV
227 Entering Passive Mode (83,143,81,38,143,34).
Opening data connection to 83.143.81.38 Port: 36642
RETR 25t-6.jpg
Timeout (30s).
Timeout
Client closed the connection.
Resolving host name "ftp.sagaforumet.com"
Connecting to 83.143.81.38 Port: 21
Client closed the connection.
Connection to host failed
***** SYNC Error #4: Cannot download remote file 25t-6.jpg. Connection timeout.
CLOSEHOST
***** CLOSEHOST Error #12001: Not connected.
Lars H.