How to get Date and Time with oFTP
How to get Date and Time with oFTP
Hi,
i'm using oFTP:Directory("*.*"), but it seems it only returns the name and file size. Is there any way to also retrieve the file's date and time?
Thanks,
John.
i'm using oFTP:Directory("*.*"), but it seems it only returns the name and file size. Is there any way to also retrieve the file's date and time?
Thanks,
John.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
John,
Please modify Class TFtp Method Directory this way:
Please modify Class TFtp Method Directory this way:
Code: Select all
...
if ! Empty( oWin32FindData:cFileName )
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow,;
oWin32FindData:nLastWriteAccess,;
oWin32FindData:nCreationTime } )
while InternetFindNextFile( hFTPDir, @cBuffer )
oWin32FindData:cBuffer = cBuffer
AAdd( aFiles, { oWin32FindData:cFileName,;
oWin32FindData:nSizeLow,;
oWin32FindData:nLastWriteAccess,;
oWin32FindData:nCreationTime } )
end
endif
...
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Hi Antonio,
i probably did something wrong because i get only empty strings returned for the date and time:
aFtpList:=oFTP:Directory("*.*")
ShowArr(aFtpList)
Function ShowArr(aDirList)
aEval(aDirList,{|i,t| iif(Valtype(i)=="A",(ShowArr(i)),(msgalert(i)) ) })
Return (.t.)
Any suggestions?
Regards,
John.
i probably did something wrong because i get only empty strings returned for the date and time:
aFtpList:=oFTP:Directory("*.*")
ShowArr(aFtpList)
Function ShowArr(aDirList)
aEval(aDirList,{|i,t| iif(Valtype(i)=="A",(ShowArr(i)),(msgalert(i)) ) })
Return (.t.)
Any suggestions?
Regards,
John.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
John,
It looks like there is something different from a number there.
Please try this:
and let me know what you get, thanks
It looks like there is something different from a number there.
Please try this:
Code: Select all
aFtpList:=oFTP:Directory("*.*")
for n = 1 to Len( aFtpList[ 1 ][ 3 ] )
MsgInfo( Asc( SubStr( aFtpList[ 1 ][ 3 ], n, 1 ) ) )
next
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
John,
so we can see the eight bytes for each file.
Code: Select all
aFtpList:=oFTP:Directory("*.*")
for m = 1 to Len( aFtpList )
for n = 1 to Len( aFtpList[ m ][ 3 ] )
MsgInfo( Asc( SubStr( aFtpList[ m ][ 3 ], n, 1 ) ) )
next
next
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
John,
It looks as three files have the same date:
0, 46, 46, 201, 78, 240, 198, 1
0, 46, 46, 201, 78, 240, 198, 1
0, 46, 46, 201, 78, 240, 198, 1
0, 232, 33, 111, 190, 255, 198, 1
From the image that you provided, three have the same date too:
15-10-2006
15-10-2006
15-10-2006
4-11-2006
Now we need to find in what data format the dates are stored.
It looks as three files have the same date:
0, 46, 46, 201, 78, 240, 198, 1
0, 46, 46, 201, 78, 240, 198, 1
0, 46, 46, 201, 78, 240, 198, 1
0, 232, 33, 111, 190, 255, 198, 1
From the image that you provided, three have the same date too:
15-10-2006
15-10-2006
15-10-2006
4-11-2006
Now we need to find in what data format the dates are stored.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: