dm_ftp_list Function

public function dm_ftp_list(server, unit, directory, names_only, debug, error_message, error_curl) result(rc)

Writes list of FTP directory contents to passed Fortran file unit unit.

The following example writes the contents of the FTP root directory to a scratch file and outputs the file afterwards:

character(len=512)    :: line
integer               :: rc, stat, unit
type(ftp_server_type) :: server

open (action='readwrite', form='formatted', newunit=unit, status='scratch')

rc = dm_ftp_init()
call dm_ftp_server_set(server, host='localhost', username='user', password='secret', tls=.false.)
rc = dm_ftp_list(server, unit, '/', names_only=.true.)
call dm_ftp_shutdown()

rewind (unit)

do
    read (unit, '(a)', iostat=stat) line
    if (stat /= 0) exit
    print '(a)', trim(line)
end do

close (unit)

The function returns the following error codes:

  • E_COMPILER if C pointers could not be nullified (compiler bug).
  • E_FTP if initialisation or connection failed.
  • E_FTP_AUTH if FTP authentication failed.
  • E_FTP_CONNECT if connection to server could not be established.
  • E_FTP_SSL if SSL/TLS error occured.
  • E_INVALID if arguments or FTP server type attributes are invalid.
  • E_IO if unit is not opened.

Arguments

Type IntentOptional Attributes Name
type(ftp_server_type), intent(inout) :: server

FTP server type.

integer, intent(in) :: unit

File unit to write to.

character(len=*), intent(in) :: directory

Path of remote FTP directory.

logical, intent(in), optional :: names_only

List only names (NLST command).

logical, intent(in), optional :: debug

Output debug messages.

character(len=:), intent(out), optional, allocatable :: error_message

Error message.

integer, intent(out), optional :: error_curl

cURL error code.

Return Value integer


Calls

proc~~dm_ftp_list~~CallsGraph proc~dm_ftp_list dm_ftp_list curl_easy_cleanup curl_easy_cleanup proc~dm_ftp_list->curl_easy_cleanup curl_easy_init curl_easy_init proc~dm_ftp_list->curl_easy_init curl_easy_perform curl_easy_perform proc~dm_ftp_list->curl_easy_perform curl_easy_setopt curl_easy_setopt proc~dm_ftp_list->curl_easy_setopt curl_slist_free_all curl_slist_free_all proc~dm_ftp_list->curl_slist_free_all interface~dm_present dm_present proc~dm_ftp_list->interface~dm_present interface~dm_sec_to_msec dm_sec_to_msec proc~dm_ftp_list->interface~dm_sec_to_msec proc~dm_ftp_error dm_ftp_error proc~dm_ftp_list->proc~dm_ftp_error proc~dm_ftp_error_message dm_ftp_error_message proc~dm_ftp_list->proc~dm_ftp_error_message proc~dm_ftp_url dm_ftp_url proc~dm_ftp_list->proc~dm_ftp_url proc~dm_is_error dm_is_error proc~dm_ftp_list->proc~dm_is_error curl_easy_strerror curl_easy_strerror proc~dm_ftp_error_message->curl_easy_strerror proc~dm_ftp_url->interface~dm_present curl_url curl_url proc~dm_ftp_url->curl_url curl_url_cleanup curl_url_cleanup proc~dm_ftp_url->curl_url_cleanup curl_url_get curl_url_get proc~dm_ftp_url->curl_url_get curl_url_set curl_url_set proc~dm_ftp_url->curl_url_set interface~dm_itoa dm_itoa proc~dm_ftp_url->interface~dm_itoa proc~dm_string_is_present dm_string_is_present proc~dm_ftp_url->proc~dm_string_is_present