#Include <FTPEx.au3>
Global Const $Host = 'ftp.mozilla.org'
Global Const $Login = ''
Global Const $Password = ''
_FTP_Download('', @ScriptDir & '\Uploaded')
Func _FTP_Download($sRemotePath, $sLocalPath)
Local $hFtp, $hSession, $aFind, $hFind, $Path, $Result = 1
DirCreate($sLocalPath)
If (Not FileExists($sLocalPath)) Or (Not StringInStr(FileGetAttrib($sLocalPath), 'D')) Then
Return 0
EndIf
$hFtp = _FTP_Open('MyFtp')
$hSession = _FTP_Connect($hFtp, $Host, $Login, $Password)
$aFind = _FTP_FindFileFirst($hSession, $sRemotePath, $hFind)
While Not @error
$Path = $sLocalPath & '\' & $aFind[10]
If BitAND($aFind[1], $FILE_ATTRIBUTE_DIRECTORY) Then
DirCreate($Path)
If (Not FileExists($Path)) Or (Not StringInStr(FileGetAttrib($Path), 'D')) Then
Return 0
EndIf
If Not _FTP_Download($sRemotePath & '/' & $aFind[10], $Path) Then
Return 0
EndIf
Else
ConsoleWrite($sLocalPath & '\' & $aFind[10] & @CR)
; If Not _FTP_FileGet($hSession, $sRemotePath & '/' & $aFind[10], $Path) Then
; $Result = 0
; EndIf
EndIf
$aFind = _FTP_FindFileNext($hFind)
WEnd
_FTP_FindFileClose($hFind)
_FTP_Close($hFtp)
Return $Result
EndFunc ;==>_FTP_Download