本帖最后由 拉风晓晓 于 2012-9-13 21:36 编辑 #RequireAdmin
#include <FTPEx.au3>
Local $sDbPath,$s_RemoteFile,$fileserver,$username,$pass,$Conn,$RESUT,$h_Handle,$aFile,$remote_time,$local_time,$local_size
$sDbPath= @ScriptDir & "\1.txt"
$s_RemoteFile="/1.txt"
$fileserver = '563221212.svfree.net'
$username = '563221212'
$pass = '123456'
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $fileserver, $username, $pass,1,21)
$aFile = _FTP_FindFileFirst($Conn,$s_RemoteFile, $h_Handle)
$remote_time=_FTP_FileTimeLoHiToStr($aFile[6],$aFile[7],1)
ConsoleWrite(@crlf&'远程文件时间'&$remote_time)
ConsoleWrite('大小'&$aFile[9] & @CRLF)
_FTP_FindFileClose($h_Handle)
$filetime=FileGetTime($sDbPath,0)
$local_size=FileGetSize($sDbPath)
If $filetime=0 Or $local_size<11000 Then
$RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
ConsoleWrite(@CRLF&'新下载'&$RESUT&@crlf)
Else
$local_time=$filetime[0]-1&"/"&$filetime[1]&"/"&$filetime[2]&" "&$filetime[3]&":"&$filetime[4]&":"&$filetime[5]
ConsoleWrite('本地文件时间'&$local_time&'大小'&$local_size)
Local $time_cmp=StringCompare($remote_time,$local_time)
ConsoleWrite(@crlf&'服务器-本地='&$time_cmp&@crlf)
If $time_cmp<0 And $local_size>11000 Then
$RESUT= _FTP_Fileput($Conn,$sDbPath,$s_RemoteFile)
ConsoleWrite(@crlf&'上传'&$RESUT&@crlf)
Else
$RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
ConsoleWrite(@CRLF&'下载'&$RESUT&@crlf)
EndIf
EndIf
_FTP_Close($Open)
|