Antonio
remove this lines for only return list of files
Add
and for SFTP, it's neccesary
and, this is important also
Full sample for directory files and conexion to SFTP
remove this lines for only return list of files
curl_easy_setopt( hCurl, HB_CURLOPT_UPLOAD )
curl_easy_setopt( hCurl, HB_CURLOPT_UL_FILE_SETUP, cFileName )
curl_easy_setopt( hCurl, HB_CURLOPT_INFILESIZE, hb_vfSize( cFileName ) )Add
curl_easy_setopt( hCurl, HB_CURLOPT_DIRLISTONLY, 1 )and for SFTP, it's neccesary
curl_easy_setopt( hCurl, HB_CURLOPT_PROTOCOLS, HB_CURLPROTO_SFTP )and, this is important also
curl_easy_setopt( hCurl, HB_CURLOPT_USE_SSL, 0 )Full sample for directory files and conexion to SFTP
curl_global_init()
if ! empty( hCurl := curl_easy_init() )
curl_easy_setopt( hCurl, HB_CURLOPT_PORT, cPort ) // default 22
curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
curl_easy_setopt( hCurl, HB_CURLOPT_USERPWD, "username:password" )
curl_easy_setopt( hCurl, HB_CURLOPT_FAILONERROR, .T. )
curl_easy_setopt( hCurl, HB_CURLOPT_FILETIME, .T. )
curl_easy_setopt( hCurl, HB_CURLOPT_NOPROGRESS, 0 )
curl_easy_setopt( hCurl, HB_CURLOPT_VERBOSE, .F. )
curl_easy_setopt( hCurl, HB_CURLOPT_DIRLISTONLY, 1 )
curl_easy_setopt( hCurl, HB_CURLOPT_USE_SSL, 0 )
curl_easy_setopt( hCurl, HB_CURLOPT_PROTOCOLS, HB_CURLPROTO_SFTP )
if ( nResult := curl_easy_perform( hCurl ) ) == 0
curl_easy_dl_buff_get( hCurl )
else
? "error code:" + Str( nResult )
endif
endif
curl_global_cleanup()
return nResult == HB_CURLE_OKCristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces