Other ftplib functions

These are the main ftplib functions we can use to execute ftp operations:

In this example, we are going to list the versions that are available in the Linux kernel FTP with the nlst() method.

You can find the following code in the list_kernel_versions_nslt.py file:

!/usr/bin/env python3

from ftplib import FTP

f = FTP('ftp.free.fr')
f.login()
f.cwd('/mirrors/ftp.kernel.org/linux/kernel/')
entries = f.nlst()
entries.sort()
print(len(entries), "entries:")
for entry in entries:
print(entry)
f.quit()