Using the ftp list command

Introduction

This is how to perform an ftp list command using net.ftp.list from the net module.

Task [top]

Using the ftp list command

Implementation [top]

This example uses the NASA ITCD ftp server — which unfortunately has now been decommissioned. So you will need to choose another ftp server.

Note: There are many (millions) of public ftp servers available on the internet — so a quick google will find you many suitable test servers.

We could have updated the code to use another ftp server, but a test server we choose today might be gone tomorrow.

Here is the code for you to copy:

function main() 
   local id=net.ftp.init{
      server='<your ftp server address>', 
      username='anonymous', password='<your email address>'}
   id:list{remote_path='/'}
   id:list{remote_path='/pub'}
en

More information [top]