× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, Nov 8, 2017 at 5:31 PM, Bob Cagle <bcagle@xxxxxxxxxxx> wrote:
I just started looking at Scott's FTPAPI. I agree, it looks quite a bit more functional.

Since this is the offshoot of your post which isn't in the RPG list, I
don't feel too bad about throwing in a mention for Python. Getting a
directory listing is simply this in Python:

from ftplib import FTP
ftp = FTP('your.host.here', 'bob', 'pwd')
listing = []
ftp.retrlines('LIST', listing.append)

After executing those four lines of code, `listing` is a list of
strings, each string being a line in the directory listing. If you
just want the names (no dates or file sizes), you would use the
command string 'NLST' instead of 'LIST'.

You can get the standard FTP error/status messages as well (I happened
to not capture it in the sample above, but that fourth line returns
the string '226 Transfer complete.' on success). Essentially all the
same functionality provided by FTPAPI is available in Python's
standard ftplib. There's also a higher-level third-party package
called ftputil which makes FTP sessions feel more like typical Python
local file system operations (and less like raw FTP commands, with
fewer if any callbacks).

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.