[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Welcome to ftpapi - TESTING



Sender: Scott Klement <klemscot@xxxxxxxxxxxx>



On Fri, 27 Sep 2002, Richard B Baird wrote:
>
> I've played around with your examples in debug mode and there's a lot to
> it.  A very nice set of tools though, i must say.
>
> Just for a little background, what i'm trying to do is to interogate a
> series of nested directories on the local IFS and and 'put' the results,
> directories included, to a remote server.
>

That shouldn't be _too_ difficult. :)  Replicating in the other direction
(from the remote FTP server to the local) would be a bit more difficult,
since I don't think there's any way (using the FTP standards, anyway) to
distinguish between a file name and a directory name.

But, going from a local directory to an FTP directory should be relatively
easy.


> for instance...
>
> dir 1a
>   dir 2a
>      dir 3a
>          filea
>          fileb
>      dir 3b
>          filea
>          fileb
>   dir 2b
>      dir 3a
>          filea
>          fileb
>      dir 3b
>          filea
>          fileb
> etc.
>
> I do know what most of the directory structure is supposed to look like,
> but I don't know:
>
> a. the names of the third level of directories.
> b. which directories i've already created on a previous pass.
> c. which files i've already retrieved.
> d. the names of the files in the directories.
>
> so, i need to interogate the local directory structure, and duplicate if
> necessary on the remote server, then copy all file within those directories
> from local to remote, bypassing the ones I may have already done
> previously.

Should be pretty easy to do using the IFS API...   That is, easy if you're
already familiar with them.

>
> I've played around with your examples, and i'm getting reasonably
> comfortable with them, but, I not that used to using service pgms,
> procedures, prototypes, etc. and some of your functions are a little less
> well documented than others, so I have a few questions.
>

Actually, one of the things that someone else could help me with would be
documentation.   Writing a manual or tutorial would be really nice.


> 1.  what are the differences between functions: FTP_dir and FTP_dirraw?

When I designed the API, I created a more "powerful" (but complex)
interface to the file transfer routines, as well as a "simplified"
interface.

The "powerful" versions are the ones that end with 'raw'.  The way they
work is, you pass it the address of a subprocedure to call every time data
is received from the server.   It calls your subprocedure for all of the
data.

In the case of FTP_dirraw, it calls the subprocedure once for each
filename in the directory.   By contrast, FTP_dir returns the results as
an array.

FTP_dir is actually implemented by calling FTP_dirraw, passing it's own
procedure (called "List2Array") as a callback.  List2Array puts the
callback info into the array so that FTP_dir can return it to you.

> 2.  could someone provide an example of using either one or both?

I could provide an example of FTP_dir, but frankly I don't think it's
what you're looking for.  The FTP_dir API is used for human-readable
directory info.   You should be using FTP_list if you plan to use them
programatically.

I'm not really clear on what you're using this for.  It's the local
file & directory names that you need, not the ones on the FTP server,
is it not?

So, tell me what you're doing, and I'll provide an example.


> 3.  an example of using the List2Array function would be useful also.

List2Array is only inteded to be used internally by FTPAPI.  It's used
by the FTP_dir and FTP_list procedures to convert the output from
FTP_dirraw and FTP_lstraw into arrays.

You should not invoke it directly.   But, it needs to be exported in order
for FTPAPI to call it at runtime.  (Which, IMHO, is a bad idea, but that's
the way it works)

>
> I'm writing this app as an all purpose ftp tool, so that I can schedule
> regular ftp transfers via a 'set-up once' control file with from/to paths,
> including replacement variables, wild cards etc., and to schedule these
> batch transfers via a command interface.    If anyone's interested, i
> wouldn't mind sharing it with the group when i'm done.
>

I'm interested.


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------