1、首先在最后加入一行use_localtime=YES。
2、其次存盘后,重启vsftpd。
用FtpFindFirstFile,InternetFindNextFile 这两个函数
FtpFindFirstFile 返回文件信息。放在 WIN32_FIND_DATA 结构中
InternetFindNextFile 调用 FtpFindFirstFile()后在目录中连续查找
当找到FTP服务器上的一个文件时,可获得该文件的最后一次修改时间
函数的声明是:
Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String,lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long,ByVal dwContent As Long) As LongPrivate Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
还需定义一个数据类型:WIN32_FIND_DATA,用于保存相关路径下的文件的信息。类型结构如下:
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
ftLastWriteTime就是最后的修改时间
例:
FtpFindFirstFile(FTP连接句柄,需要知道日期的文件名,WIN32_FIND_DATA格式的变量,2,0)
API函数FileTimeToSystemTime可以将FILETIME转换为系统时间结构SYSTEMTIME
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)