FTP同步,XP下正常编译运行,WIN7运行报错(已解决)
本帖最后由 拉风晓晓 于 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,$aFile,1)
ConsoleWrite(@crlf&'远程文件时间'&$remote_time)
ConsoleWrite('大小'&$aFile & @CRLF)
_FTP_FindFileClose($h_Handle)
$filetime=FileGetTime($sDbPath,0)
$local_size=FileGetSize($sDbPath)
If $filetime=0Or $local_size<11000 Then
$RESUT= _FTP_Fileget($Conn,$s_RemoteFile,$sDbPath)
ConsoleWrite(@CRLF&'新下载'&$RESUT&@crlf)
Else
$local_time=$filetime-1&"/"&$filetime&"/"&$filetime&" "&$filetime&":"&$filetime&":"&$filetime
ConsoleWrite('本地文件时间'&$local_time&'大小'&$local_size)
Local $time_cmp=StringCompare($remote_time,$local_time)
ConsoleWrite(@crlf&'服务器-本地='&$time_cmp&@crlf)
If $time_cmp<0And $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) 自己解决了,实际代码不是这个FTP服务器
当$aFile = _FTP_FindFileFirst($Conn,$s_RemoteFile, $h_Handle)这句时,FTP服务器没有回应值,造成$aFile,$aFile都是错误的数
win7 x86
au3:3.3.7.15
这个应该算正常吧,没发现报错。。
页:
[1]