|
Having a problem with list and get. List brings back nothing, get always gives -4 error. Connects ok per job log. Doing manually with same works? Any ideas? Mark Allen I.S. Manager Wilkes Telephone & Electric A Dycom Company Phone: (706) 678-9565 Email: allenmark@nu-z.net http://www.nu-z.net :-----Original Message----- :From: midrange-l-admin@midrange.com :[mailto:midrange-l-admin@midrange.com] On Behalf Of Scott Klement :Sent: Thursday, February 21, 2002 4:39 PM :To: midrange-l@midrange.com :Subject: Re: BATCH ftp ? : : : :On Thu, 21 Feb 2002, Mark Allen wrote: :> :> Having a problem with getting this to do what I want. What :I need it :> to do is stay in the FTP session after the dir in the sctipt file :> (listed :> below) because we do not know what the file name will be. I want the :> operator to manually enter the appropriate get command but the ftp :> session does an "implicit" quit after the last line of the FTP script :> and the runqry starts. Can I do wat I want or is the "whole" thing :> going to have to be manual. :> : :Err... once you run the FTP command, you can't exit it without :disconnecting from the server. : :A *much* easier way to do this would be with my open-source :FTPAPI service program. It's designed to let you write your :own FTP client with minimal effort, and make it do whatever you like. : :Here is an example of how you could do this with FTPAPI :(example is in RPG IV): : : C* Connect to server : C eval fd = ftp_conn('host': 'userid': :'password') : C if fd < 0 : c eval Msg = ftp_error : C* here you'd want to display the error message "MSG" and then abort : c endif : : C* Change directory : C callp ftp_chdir(fd: 'pub/SomeDir/Somewhere') : : C* do a "dir" to "my_array", one filename per array entry : C if ftp_list(fd: '*.txt': 5: : C %addr(my_array): num_files) < 0 : c callp ftp_error(error_num) : c if error_num = FTP_NOFILE : C* no files were in that directory : c else : c eval msg = ftp_error : c* display error message here : c endif : : C* grab each file in this directory : C for f = 1 to num_files : c callp ftp_get(fd: my_array(f): '/localdir/'+ : c my_array(f)) : c endfor : : C* disconnect from server : c callp ftp_quit(fd) : : :Much easier than trying to do the same thing with an FTP script! : :If you check the return code from every function (I only did :it on ftp_conn and ftp_list in that example) you'd be able to :detect every error in your transmission without having to :parse a complicated output file. : :So, check it out... it's free, and only requires V3R2 or :later. http://klement.dstorm.net/ftpapi/ : : : :_______________________________________________ :This is the Midrange Systems Technical Discussion (MIDRANGE-L) :mailing list To post a message email: MIDRANGE-L@midrange.com :To subscribe, unsubscribe, or change list options, :visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l :or email: MIDRANGE-L-request@midrange.com :Before posting, please take a moment to review the archives :at http://archive.midrange.com/midrange-l. : :
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.