 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Karen
Joined: 20 Dec 2004 Posts: 20
|
|
ftpputfile delay |
|
I need to allow for a delay in the FTPPutFile command after entering the userid and password info... The ftp site scrolls thru some information prior to allowing a directory change and put command.. ? can someone assist?
|
|
Mon Mar 28, 2005 4:50 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7974
|
|
Re: ftpputfile delay |
|
I am afraid this cannot be done using FTPPutFile. FTPPutFile is a high-level FTP method for transferring single or multiple FPT files in one step. It doesn't support injecting any other processing logic in the middle of the processing. I suggest building a simple command line FTP script that can be executed using FTP -s command. We have discussed this method numerous times. Please search this board for topics containing "FTP –s" keyword. For example, take a look at http://www.softtreetech.com/cgi_bin/config.cgi?review=6405 message. Because the command line FTP doesn't support any "delay" command you would need to call In your case you would need to use "escape to shell" to call some external utility to implement the delay. If the required delay is short you can use a simple method like using "dir" command for a directory containing lots of files. For example the following command will surely create a few seconds delay. If needed you can call it several times to increase the delay: ! cmd /C dir C:\winnt /s Good luck : I need to allow for a delay in the FTPPutFile command after : entering the userid and password info... The ftp site scrolls thru : some information prior to allowing a directory change and put command.. : ? can someone assist?
|
|
Mon Mar 28, 2005 5:37 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7974
|
|
Re: ftpputfile delay |
|
I actually meant http://www.softtreetech.com/cgi_bin/config.cgi?read=6323 for the link : I am afraid this cannot be done using FTPPutFile. FTPPutFile is a high-level : FTP method for transferring single or multiple FPT files in one step. It : doesn't support injecting any other processing logic in the middle of the : processing. : I suggest building a simple command line FTP script that can be executed : using FTP -s command. We have discussed this method numerous times. Please : search this board for topics containing "FTP –s" keyword. For : example, take a look at : http://www.softtreetech.com/cgi_bin/config.cgi?review=6405 message. : Because the command line FTP doesn't support any "delay" command : you would need to call In your case you would need to use "escape to : shell" to call some external utility to implement the delay. If the : required delay is short you can use a simple method like using : "dir" command for a directory containing lots of files. For : example the following command will surely create a few seconds delay. If : needed you can call it several times to increase the delay: ! cmd /C dir : C:\winnt /s : Good luck
|
|
Mon Mar 28, 2005 5:37 pm |
|
 |
Karen
Joined: 20 Dec 2004 Posts: 20
|
|
Re: ftpputfile delay |
|
Created a batch file - calling it from my script... "cmd /C c:\download\batchfile.bat" This works except I am unable to pass a filename parameter to the batch file. Any ideas on how to pass the correct filename created in my job to the batchfile? : I actually meant http://www.softtreetech.com/cgi_bin/config.cgi?read=6323 : for the link
|
|
Tue Mar 29, 2005 11:55 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7974
|
|
Re: ftpputfile delay |
|
Example, // create time-based file name in the default temp directory Dim file_name, string, "@V"env:TEMP"\\@T"mm-dd-yy".txt" FileSave file_name, "some text" // Build command line for the batch file and run it Dim command, string ConcatEx "cmd /C c:\\download\\batchfile.bat ", file_name, command Dim pid RunAndWait command, "", pid // delete temp file FileDelete file_name : Created a batch file - calling it from my script... : "cmd /C c:\download\batchfile.bat" : This works except I am unable to pass a filename : parameter to the batch file. : Any ideas on how to pass the correct filename created : in my job to the batchfile?
|
|
Tue Mar 29, 2005 12:01 pm |
|
 |
Karen
Joined: 20 Dec 2004 Posts: 20
|
|
Re: ftpputfile delay |
|
Are you saying in your example that the batch file should know what file_name is? Within the batch file is the FTP "put" command - this is where I need to pass the file_name. : Example, : // create time-based file name in the default temp directory : Dim file_name, string, : "@V"env:TEMP"\\@T"mm-dd-yy".txt" : FileSave file_name, "some text" : // Build command line for the batch file and run it : Dim command, string : ConcatEx "cmd /C c:\\download\\batchfile.bat ", file_name, command : Dim pid : RunAndWait command, "", pid : // delete temp file : FileDelete file_name
|
|
Tue Mar 29, 2005 1:02 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7974
|
|
Re: ftpputfile delay |
|
This is how I understood your question. You said you don't know how to pass file name to your batch file. Anyway, in FTP script it is simply cd [target dir] put [local file name here] : Are you saying in your example that the batch file should : know what file_name is? : Within the batch file is the FTP "put" command - this is where : I need to pass the file_name.
|
|
Tue Mar 29, 2005 1:15 pm |
|
 |
Karen
Joined: 20 Dec 2004 Posts: 20
|
|
Re: ftpputfile delay |
|
Sounds easy enough.... I appreciate your assistance. The batch file is as you describe below... Where [local file name here] - I need to identify the file created via pgp process inside my job. for example: "c:\pgp\mynewpgp.txt.pgp" When I run the ftp script via batchfile, this is what I need the line to read... put c:\pgp\mynewpgp.txt.pgp Can you assist? : This is how I understood your question. You said you don't know how to pass : file name to your batch file. : Anyway, in FTP script it is simply : cd [target dir] : put [local file name here]
|
|
Tue Mar 29, 2005 1:46 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7974
|
|
Re: ftpputfile delay |
|
This line looks fine and it should work as long as the file mentioned file is there. : Sounds easy enough.... I appreciate your assistance. : The batch file is as you describe below... : Where [local file name here] - I need to identify the : file created via pgp process inside my job. : for example: "c:\pgp\mynewpgp.txt.pgp" : When I run the ftp script via batchfile, this is what I : need the line to read... : put c:\pgp\mynewpgp.txt.pgp : Can you assist?
|
|
Tue Mar 29, 2005 2:29 pm |
|
 |
Karen
Joined: 20 Dec 2004 Posts: 20
|
|
Re: ftpputfile delay |
|
Thats my problem... If I "hardcode" the filename within the batch file, I'm fine but, the filename changes each time the job is run... I want to pass the filename from inside my job to the batch file which is where I'm getting stuck... I tried your prior suggestion but, it doesn't recognize what I'm sending it. : This line looks fine and it should work as long as the file mentioned file is : there.
|
|
Tue Mar 29, 2005 2:53 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7974
|
|
Re: ftpputfile delay |
|
Karen, You can write the ftp script dynamically from the job, I mean the FTP script, not the batch script. This way the contents of the ftp script could be anything. For example, Dim my_file, string Dim my_script, string Dim pid Set my_file, "pgp.whatever.txt" ConcatEx "open mysite\r\nuser me\r\npwd pass\r\ncd some_dir\r\nput ", my_file, "\r\nquit\r\n", my_script FileSave "c:\\ftp\\whatever.ftp", my_script RunAndWait "cmd /c ftp -n -s:c:\\ftp\\whatever.ftp", "", 0, pid FileDelete "c:\\ftp\\whatever.ftp" : Thats my problem... If I "hardcode" the filename within the batch : file, : I'm fine but, the filename changes each time the job is run... : I want to pass the filename from inside my job to the batch file which : is where I'm getting stuck... : I tried your prior suggestion but, it doesn't recognize what I'm sending it.
|
|
Tue Mar 29, 2005 3:30 pm |
|
 |
Karen
Joined: 20 Dec 2004 Posts: 20
|
|
Re: ftpputfile delay |
|
This works great!!! Thank you for helping accomplish this task! : Karen, : You can write the ftp script dynamically from the job, I mean the FTP script, : not the batch script. This way the contents of the ftp script could be : anything. For example, : Dim my_file, string : Dim my_script, string : Dim pid : Set my_file, "pgp.whatever.txt" : ConcatEx "open mysite\r\nuser me\r\npwd pass\r\ncd some_dir\r\nput : ", my_file, "\r\nquit\r\n", my_script : FileSave "c:\\ftp\\whatever.ftp", my_script : RunAndWait "cmd /c ftp -n -s:c:\\ftp\\whatever.ftp", "", : 0, pid : FileDelete "c:\\ftp\\whatever.ftp"
|
|
Tue Mar 29, 2005 5:38 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|