Muy buenas Foro, estoy utilizando la funcion ReadFile o Directory para FTP con un timer, la PRIMERA vez que ejecuta la función lo hace bien pero, cuando se añaden o eliminan ficheros del directorio SIEMPRE me devuelve el array de la PRIMERA lectura ¿que puede ser?, este es mi código de la funcion:
method ReadFiles( cMask ) class CDIftp
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
ENDSTRUCT
if ::oFTP != nil
cBuffer = oWin32FindData:cBuffer
hFTPDir = FtpFindFirstFile( ::oFTP, cMask, @cBuffer, 0, 0 )
oWin32FindData:cBuffer = cBuffer
if ! Empty( oWin32FindData:cFileName )
msginfo(oWin32FindData:cFileName)
aadd( aFiles, { oWin32FindData:cFileName,oWin32FindData:nSizeLow,FileTimeToDate(oWin32FindData:nLastWriteAccess),FileTimeToTime(oWin32FindData:nLastWriteAccess),oWin32FindData:nFileAttributes} )
while InternetFindNextFile( hFTPDir, @cBuffer )
oWin32FindData:cBuffer = cBuffer
msginfo(oWin32FindData:cFileName)
aadd( aFiles, { oWin32FindData:cFileName,oWin32FindData:nSizeLow,FileTimeToDate(oWin32FindData:nLastWriteAccess),FileTimeToTime(oWin32FindData:nLastWriteAccess),oWin32FindData:nFileAttributes } )
end
end if
InternetCloseHandle(hFTPDir)
end if
cBuffer:=nil
oWin32FindData:cBuffer:=nil
oWin32FindData:=nil
hFTPDir:=nil
return aFiles
Un Saludo.