FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour oFTP:Directory() no devuelve los archivos que existem
Posts: 230
Joined: Thu Sep 17, 2015 11:40 PM
Re: oFTP:Directory() no devuelve los archivos que existem
Posted: Tue Apr 22, 2025 04:07 PM
Enrrique Vertiz wrote: Saludos

Gracias Carlos, pero me pasa con los 3 proveedores mas grandes aqui Movistar, Claro y Win, cubren el 90% (aprox) de las instalaciones ... ademas Filezilla si me deja y una prueba con Chilkat tambien.

Joao gracias por los links revisare 1x1 a ver si encuentro luz ...
si los mismo sintomas tenia con wow y tuve que cambiar el metodo de actualizacion para los clientes con este proveedor a descargar desde la pagina un actualizador y hacer una reinstalacion para actualizar la aplicacion y me cambie a Claro y no tengo ese problema y no recomiendo ni wow, tu servidor ftp esta en una vps o hosting revisa si no esta bloqueado el ip, si gustas podemos probar desde mi pc por anydesk para descartar
Carlos Atuncar - CaSoftSystem
Chincha - Perú
+51983478218
carlosalbatun@gmail.com
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: oFTP:Directory() no devuelve los archivos que existem
Posted: Tue Apr 22, 2025 09:22 PM

Saludos Carlos

Gracias, ya consegui hacerlo funcionar

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
Posts: 230
Joined: Thu Sep 17, 2015 11:40 PM
Re: oFTP:Directory() no devuelve los archivos que existem
Posted: Thu Apr 24, 2025 11:55 PM

hola comenta por favor como lo solucionastes por que aun tengo algunos problemas con algunos clientes. Gracias

Carlos Atuncar - CaSoftSystem
Chincha - Perú
+51983478218
carlosalbatun@gmail.com
Posts: 582
Joined: Fri Oct 07, 2005 02:17 PM
Re: oFTP:Directory() no devuelve los archivos que existem
Posted: Fri Apr 25, 2025 03:57 AM

Saludos Carlos, un colega me paso la clase FTP y la aumente en mi codigo, no se si de tanto codigo tengo alguna libreria o clase anterior, simplemehte aumente el codigo de la clase y me funciono, creo q es igual que la que esta en FWH pero por si acaso la copio

include "FiveWin.ch"

include "Struct.ch"

define INTERNET_SERVICE_FTP 1

define FTP_PORT 21

//----------------------------------------------------------------------------//

CLASS TFTP

DATA oInternet // TInternet container object

DATA cSite // URL address

DATA hFTP // handle of the FTP connection

DATA cUserName // user name to login

DATA cPassword // password to login

METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CONSTRUCTOR // generic constructor

METHOD End() // generic destructor

METHOD DeleteFile( cFileName ) // deletes a remote FTP file

METHOD Directory( cMask ) // as Clipper Directory() but on a FTP site!

METHOD RenameFile( cOldFileName, cNewFileName ) // renames a file

METHOD SetCurrentDirectory( cDirName ) INLINE ;

        FtpSetCurrentDirectory( ::hFTP, cDirName )

METHOD CreateDirectory( cDirName ) INLINE ;

        FtpCreateDirectory( ::hFTP, cDirName )

ENDCLASS

//----------------------------------------------------------------------------//

//METHOD New( cFTPSite, oInternet, cUserName, cPassword ) CLASS TFTP

//

// ::oInternet = oInternet

// ::cSite = cFTPSite

// ::cUserName = cUserName

// ::cPassword = cPassword

//

// if oInternet:hSession != nil

// ::hFTP = InternetConnect( oInternet:hSession, cFTPSite, FTP_PORT,;

// ::cUserName, ::cPassword,;

// INTERNET_SERVICE_FTP, 0, 0 )

// AAdd( oInternet:aFTPs, Self )

// endif

//

//return Self

METHOD New( cFTPSite, oInternet, cUserName, cPassword, nFlags ) CLASS TFTP

DEFAULT nFlags := INTERNET_FLAG_PASSIVE

::oInternet = oInternet

::cSite = cFTPSite

::cUserName = cUserName

::cPassword = cPassword

if oInternet:hSession != nil

 ::hFTP = InternetConnect( oInternet:hSession, cFTPSite, FTP_PORT,;

                           ::cUserName, ::cPassword,;

                           INTERNET_SERVICE_FTP, nFlags, 0 )

 AAdd( oInternet:aFTPs, Self )

endif

return Self

//----------------------------------------------------------------------------//

METHOD End() CLASS TFTP

if ::hFTP != nil

  InternetCloseHandle( ::hFTP )

  ::hFTP = nil

endif

return nil

//----------------------------------------------------------------------------//

METHOD DeleteFile( cFileName ) CLASS TFTP

return If( ::hFTP != nil, FtpDeleteFile( ::hFTP, cFileName ), .f. )

//----------------------------------------------------------------------------//

METHOD Directory( cMask ) CLASS TFTP

local hFTPDir, aFiles := {}

local oWin32FindData, cBuffer

DEFAULT cMask := "."

STRUCT oWin32FindData

  MEMBER nFileAttributes  AS DWORD

  MEMBER nCreationTime    AS STRING LEN 8

  MEMBER nLastReadAccess  AS STRING LEN 8

  MEMBER nLastWriteAccess AS STRING LEN 8

  MEMBER nSizeHight       AS DWORD

  MEMBER nSizeLow         AS DWORD

  MEMBER nReserved0       AS DWORD

  MEMBER nReserved1       AS DWORD

  MEMBER cFileName        AS STRING LEN 260

  MEMBER cAltName         AS STRING LEN  14

  MEMBER dummy            AS STRING LEN  50

ENDSTRUCT

if ::hFTP != nil

  cBuffer = oWin32FindData:cBuffer

  hFTPDir = FtpFindFirstFile( ::hFTP, cMask, @cBuffer, 0, 0 )

  oWin32FindData:cBuffer = cBuffer

  if ! Empty( oWin32FindData:cFileName )

     AAdd( aFiles, { oWin32FindData:cFileName,;

                     oWin32FindData:nSizeLow,;

                     FileTimeToDate( oWin32FindData:nLastWriteAccess ),;

                     FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )

     while InternetFindNextFile( hFTPDir, @cBuffer )

        oWin32FindData:cBuffer = cBuffer

        AAdd( aFiles, { oWin32FindData:cFileName,;

                        oWin32FindData:nSizeLow,;

                        FileTimeToDate( oWin32FindData:nLastWriteAccess ),;

                        FileTimeToTime( oWin32FindData:nLastWriteAccess ) } )

     end

  endif

  InternetCloseHandle( hFTPDir )

endif

return aFiles

//----------------------------------------------------------------------------//

METHOD RenameFile( cOldFileName, cNewFileName ) CLASS TFTP

return If( ::hFTP != nil, FtpRenameFile( ::hFTP, cOldFileName, cNewFileName ), .f. )

Enrrique Vertiz Pitta

Lima-Peru

xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m

Continue the discussion