8987769 发表于 2010-9-7 22:33:36

关于FTP下载全部文件的问题

弄了蛮就还是只下得单个文件,附源码希望高手指教下{:1_345:}


#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <ftpex.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("上下工具", 331, 114, 232, 120)
$Input1 = GUICtrlCreateInput("", 0, 16, 329, 21)
$Button2 = GUICtrlCreateButton("上传", 31, 72, 65, 33)
$Button3 = GUICtrlCreateButton("下载", 142, 72, 65, 33)
$Button4 = GUICtrlCreateButton("退出", 252, 72, 65, 33)
$Progress1 = GUICtrlCreateProgress(0, 48, 329, 9)
GUISetState(@SW_SHOW)
$server = '192.168.1.9'
$username = '1'
$pass = '1'

#EndRegion ### END Koda GUI section ###
Local $nMsg
While 1
        $nMsg = GUIGetMsg()
        Select
                Case $nMsg = $Button4
                        Exit
                Case $nMsg = $GUI_EVENT_CLOSE
                        Exit
                       
      Case $nmsg =$Button2
$var = FileSelectFolder("选择一个文件夹.", "")
       GUICtrlSetData($Input1, $var)
$full_path = GUICtrlRead($Input1)
If($full_path=="") Then
ContinueLoop
EndIf

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
$Ftpp = _FTP_DirPutContents($Conn,$var,"",1)
$Ftpc = _FTP_Close($Open)

MsgBox(4096,"恭喜你","上传成功",3)



   Case $nmsg = $Button3
$var = FileSelectFolder("选择一个文件夹.", "")
                        GUICtrlSetData($Input1, $var)
$full_path = GUICtrlRead($Input1)
If($full_path=="") Then
ContinueLoop
EndIf

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
$huo = _FTP_DirGetCurrent($conn)
$ftpd = _FTP_FileGet($Conn,$huo & "\Autoit3CHS.rar",$var & "\Autoit3CHS.rar",1)
$Ftpc = _FTP_Close($Open)          

MsgBox(4096,"恭喜你","下载成功",3)


      
   
      EndSelect
WEnd

qddoit 发表于 2010-9-7 23:24:40

关注中。。。

8987769 发表于 2010-9-17 22:13:59

路过不放过

liufenglg 发表于 2010-9-18 16:41:18

由FTP_FindFileFirstftp_findfilenext取得ftp中所有文件名然后一一取的?
页: [1]
查看完整版本: 关于FTP下载全部文件的问题