Author |
Message |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
how to move a file in FTP on remote server? |
|
I want to move some files to an archive folder on a remote server once I have finished copying them.
eg file :
/pfvu/pfv6/test.txt
to
/pfu/pfv6/archive/test.txt
Normally I would use the "mv" command to do this.
How can I achieve this ?
|
|
Wed Feb 05, 2003 1:05 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: how to move a file in FTP on remote server? |
|
If you can map these remote directories and network shares you can schedule JAL script using FileMoveEx operation or alternatively schedule DOS batch file using MOVE command. If you cannot map these remote directories as network shares you can either use 24x7 Telnet automation statements or use FTPCommand to execute operation system command on one of these computers (using the same UNIX MV command). The latest is more straight but it requires that your FTP server support SITE option. Not all FTP servers support this option. Please check FTPCommand topic in the online help file for more details. Let me know which method is preferred and I provide you with an example script. : I want to move some files to an archive folder on a remote server once I have : finished copying them. : eg file : /pfvu/pfv6/test.txt : to : /pfu/pfv6/archive/test.txt : Normally I would use the "mv" command to do this. : How can I achieve this ?
|
|
Wed Feb 05, 2003 2:22 pm |
|
 |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
Re: how to move a file in FTP on remote server? |
|
I don't think FTPCommand works as I got an error. So I am trying a telnet method : I can connect OK but my MV command seems to make it prompt for a password and dores not move the files - this does not happen if I do it normally on the console : Dim( result, string ) Dim( finished, boolean ) Dim( index, number ) // configure connection (optional steps) TelnetConfig( "terminal", "show" ) TelnetConfig( "timeout", "30" ) TelnetConfig( "AUTHENTICATE", FALSE ) // establish new connection TelnetOpen( "9.9.9.9", "username", "password" ); // sleep for 30 seconds to allow server return "welcome" message Wait( 30 ) TelnetSend( "mv /pfu/pfv6/export/dialler/*.txt /pfu/pfv6/export/dialler/archive" ) // get the result TelnetReceive( result ) TelnetClose( )
|
|
Thu Feb 06, 2003 6:42 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: how to move a file in FTP on remote server? |
|
Why are you doing TelnetConfig( "AUTHENTICATE", FALSE ) if you need to logon to the machine? When authenticate option is turned off TelnetOpen simply opens new Telnet session without sending your user name and password. Try simple script like the following: //////////////////////////////////////////// Dim( result, string ) TelnetOpen( "9.9.9.9", "username", "password" ) Wait( 10 ) TelnetSend( "mv /pfu/pfv6/export/dialler/*.txt /pfu/pfv6/export/dialler/archive" ) TelnetReceive( result ) TelnetClose( ) LogAddMessageEx("INFO", 0, "MV command status", result ) //////////////////////////////////////////// : I don't think FTPCommand works as I got an error. : So I am trying a telnet method : I can connect OK but my MV command seems to : make it prompt for a password and dores not move the files - this does not : happen if I do it normally on the console : Dim( result, string ) : Dim( finished, boolean ) : Dim( index, number ) : // configure connection (optional steps) : TelnetConfig( "terminal", "show" ) : TelnetConfig( "timeout", "30" ) : TelnetConfig( "AUTHENTICATE", FALSE ) : // establish new connection : TelnetOpen( "9.9.9.9", "username", "password" : ); : // sleep for 30 seconds to allow server return "welcome" message : Wait( 30 ) : TelnetSend( "mv /pfu/pfv6/export/dialler/*.txt : /pfu/pfv6/export/dialler/archive" ) : // get the result : TelnetReceive( result ) : TelnetClose( )
|
|
Thu Feb 06, 2003 8:53 am |
|
 |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
Re: how to move a file in FTP on remote server? |
|
: Why are you doing TelnetConfig( "AUTHENTICATE", FALSE ) : if you need to logon to the machine? because it was not logging on - it brought up the telnet window and said something like "waiting for prompt" and timed out even though I was opening a session and sending the username and password, so I looked in the archives and saw a similar problem and he was recommended to do the authentication FALSE option.
|
|
Thu Feb 06, 2003 9:07 am |
|
 |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
Re: how to move a file in FTP on remote server? |
|
I have done a simple log on as you recommended and I get the old message again - the telnet window and in the ttitle of the window it says "Terminal: Waiting for Login Prompt@ and times-out
|
|
Thu Feb 06, 2003 9:16 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: how to move a file in FTP on remote server? |
|
This sounds as you need to do TelnetConfig with "LOGIN PROMPT" option. By default TelnetOpen expects your server to send "login" prompt. It will not work if the prompts is "user:" or something else. If the prompt is different TelnetOpen misses it and eventually times out with an error. Same thing is can happen for the password prompt. Please check out available options for TelnetConfig in the online help. : I have done a simple log on as you recommended and I get the old message : again - the telnet window and in the ttitle of the window it says : "Terminal: Waiting for Login Prompt@ and times-out
|
|
Thu Feb 06, 2003 9:31 am |
|
 |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
Re: how to move a file in FTP on remote server? |
|
yeah I tried that too : I added : TelnetConfig("LOGIN PROMPT", "login: ") TelnetConfig("PASSWORD PROMPT", "Password:") because when you log on the cursor appears one space after the colon of the login prompt - the password is directly next to it though. In any case this had no effect.
|
|
Thu Feb 06, 2003 9:40 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: how to move a file in FTP on remote server? |
|
The space is not important but the case is. You may want to enable trace option in the Tools/Option/Log. This will cause all Telnet statements to write complete tracing to the telnet.log file. Analyze this file to find out how exactly the prompt is sent by the server. : yeah I tried that too : I added : TelnetConfig("LOGIN PROMPT", : "login: ") : TelnetConfig("PASSWORD PROMPT", "Password:") : because when you log on the cursor appears one space after the colon of the : login prompt - the password is directly next to it though. : In any case this had no effect.
|
|
Thu Feb 06, 2003 9:50 am |
|
 |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
Re: how to move a file in FTP on remote server? |
|
OK have done that but I don't really understand the trace file - here it is if you can shed any light on the matter : TELNET 06/02/03 14:04:28>> LOG> telnet protocol enabled TELNET 06/02/03 14:04:28>> LOG> Resolving host name 10.10.1.7 TELNET 06/02/03 14:04:28>> LOG> Resolving service name telnet TELNET 06/02/03 14:04:28>> LOG> Connecting to 10.10.1.7/23 TELNET 06/02/03 14:04:28>> LOG> Connecting to 10.10.1.7/23 TELNET 06/02/03 14:04:28>> LOG> Online to 10.10.1.7/23 TELNET 06/02/03 14:04:28>> LOG> Client initiated options TELNET 06/02/03 14:04:28>> LOG> send WILL NAWS TELNET 06/02/03 14:04:28>> LOG> send WILL LFLOW TELNET 06/02/03 14:04:28>> LOG> send DO SGA TELNET 06/02/03 14:04:28>> LOG> Server initiated options TELNET 06/02/03 14:04:28>> LOG> recv DO TTYPE TELNET 06/02/03 14:04:28>> LOG> send WILL TTYPE TELNET 06/02/03 14:04:28>> LOG> recv DO TSPEED TELNET 06/02/03 14:04:28>> LOG> send WONT TSPEED TELNET 06/02/03 14:04:28>> LOG> recv DO XDISPLOC TELNET 06/02/03 14:04:28>> LOG> send WONT XDISPLOC TELNET 06/02/03 14:04:28>> LOG> recv DO NEWENV TELNET 06/02/03 14:04:28>> LOG> send WONT NEWENV TELNET 06/02/03 14:04:28>> LOG> recv DO OLDENV TELNET 06/02/03 14:04:28>> LOG> send WONT OLDENV TELNET 06/02/03 14:04:28>> LOG> recv DO NAWS TELNET 06/02/03 14:04:28>> LOG> recv DO LFLOW TELNET 06/02/03 14:04:28>> LOG> recv WILL SGA TELNET 06/02/03 14:04:29>> LOG> send DO SGA TELNET 06/02/03 14:04:29>> LOG> recv SB TERMINAL-TYPE SEND IAC SE TELNET 06/02/03 14:04:29>> LOG> send SB TTYPE IS VT100 IAC SE TELNET 06/02/03 14:04:29>> LOG> recv DO ECHO TELNET 06/02/03 14:04:29>> LOG> send WILL ECHO TELNET 06/02/03 14:04:29>> LOG> recv WILL STATUS TELNET 06/02/03 14:04:29>> LOG> send DONT STATUS TELNET 06/02/03 14:04:29>> LOG> recv DONT ECHO TELNET 06/02/03 14:04:29>> LOG> send WONT ECHO TELNET 06/02/03 14:04:29>> LOG> recv WILL ECHO TELNET 06/02/03 14:04:29>> LOG> send DO ECHO TELNET 06/02/03 14:04:29>> RECEIVE> TELNET 06/02/03 14:04:58>> LOG> Offline TELNET 06/02/03 14:04:58>> ERROR> Timeout. Stopping connection.
|
|
Thu Feb 06, 2003 10:07 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: how to move a file in FTP on remote server? |
|
Is this all? I see only spaces after "RECEIVE>" Please send screen shot of your regular Telnet screen with the login and password prompt and screen shot of 24x7 Telnet debugger terminal to support@softtreetech.com. To make a screen shot of active window you can use ALT+PRINT SCREEN hot key. The schreen shot gets copied to the clipboard as a bitmap picture wich you can then paste into MS Word, Windows Paint or other graphical application. : OK have done that but I don't really understand the trace file - here it is : if you can shed any light on the matter : TELNET 06/02/03 14:04:28>> : LOG> telnet protocol enabled : TELNET 06/02/03 14:04:28>> LOG> Resolving host name 10.10.1.7 : TELNET 06/02/03 14:04:28>> LOG> Resolving service name telnet : TELNET 06/02/03 14:04:28>> LOG> Connecting to 10.10.1.7/23 : TELNET 06/02/03 14:04:28>> LOG> Connecting to 10.10.1.7/23 : TELNET 06/02/03 14:04:28>> LOG> Online to 10.10.1.7/23 : TELNET 06/02/03 14:04:28>> LOG> Client initiated options : TELNET 06/02/03 14:04:28>> LOG> send WILL NAWS : TELNET 06/02/03 14:04:28>> LOG> send WILL LFLOW : TELNET 06/02/03 14:04:28>> LOG> send DO SGA : TELNET 06/02/03 14:04:28>> LOG> Server initiated options : TELNET 06/02/03 14:04:28>> LOG> recv DO TTYPE : TELNET 06/02/03 14:04:28>> LOG> send WILL TTYPE : TELNET 06/02/03 14:04:28>> LOG> recv DO TSPEED : TELNET 06/02/03 14:04:28>> LOG> send WONT TSPEED : TELNET 06/02/03 14:04:28>> LOG> recv DO XDISPLOC : TELNET 06/02/03 14:04:28>> LOG> send WONT XDISPLOC : TELNET 06/02/03 14:04:28>> LOG> recv DO NEWENV : TELNET 06/02/03 14:04:28>> LOG> send WONT NEWENV : TELNET 06/02/03 14:04:28>> LOG> recv DO OLDENV : TELNET 06/02/03 14:04:28>> LOG> send WONT OLDENV : TELNET 06/02/03 14:04:28>> LOG> recv DO NAWS : TELNET 06/02/03 14:04:28>> LOG> recv DO LFLOW : TELNET 06/02/03 14:04:28>> LOG> recv WILL SGA : TELNET 06/02/03 14:04:29>> LOG> send DO SGA : TELNET 06/02/03 14:04:29>> LOG> recv SB TERMINAL-TYPE SEND IAC SE : TELNET 06/02/03 14:04:29>> LOG> send SB TTYPE IS VT100 IAC SE : TELNET 06/02/03 14:04:29>> LOG> recv DO ECHO : TELNET 06/02/03 14:04:29>> LOG> send WILL ECHO : TELNET 06/02/03 14:04:29>> LOG> recv WILL STATUS : TELNET 06/02/03 14:04:29>> LOG> send DONT STATUS : TELNET 06/02/03 14:04:29>> LOG> recv DONT ECHO : TELNET 06/02/03 14:04:29>> LOG> send WONT ECHO : TELNET 06/02/03 14:04:29>> LOG> recv WILL ECHO : TELNET 06/02/03 14:04:29>> LOG> send DO ECHO : TELNET 06/02/03 14:04:29>> RECEIVE> : TELNET 06/02/03 14:04:58>> LOG> Offline : TELNET 06/02/03 14:04:58>> ERROR> Timeout. Stopping connection.
|
|
Thu Feb 06, 2003 11:41 am |
|
 |
Dominic Klein
Joined: 23 Nov 2001 Posts: 132
|
|
Re: how to move a file in FTP on remote server? |
|
: Is this all? I see only spaces after "RECEIVE>" : Please send screen shot of your regular Telnet screen with the login and : password prompt and screen shot of 24x7 Telnet debugger terminal to : support@softtreetech.com. : To make a screen shot of active window you can use ALT+PRINT SCREEN hot key. : The schreen shot gets copied to the clipboard as a bitmap picture wich you : can then paste into MS Word, Windows Paint or other graphical application. what do you mean by the 24x7 Telnet debugger terminal ? do you mean run 24x7 script in debug mode or send you the telnet.log file ?
|
|
Thu Feb 06, 2003 11:53 am |
|
 |
|