PerryRaptor Posted January 23, 2007 Share Posted January 23, 2007 Subject says it all...I'm lost! I've got the FTP.au3 include, but there isn't a command to count files in it. I'm struggling through a For...Next loop playing with _FtpFileFindNext() in hopes of getting the file names into an array. Any ideas? Link to comment Share on other sites More sharing options...
Zedna Posted January 23, 2007 Share Posted January 23, 2007 Look hereThere is also example of use. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PerryRaptor Posted January 23, 2007 Author Share Posted January 23, 2007 I've already chewed through that post and examples Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2007 Moderators Share Posted January 23, 2007 This looks like the road you're trying to travel: http://www.autoitscript.com/forum/index.ph...st&p=253635But I don't know, since you've posted on that same page... Are you sure you even have permissions? Have you tried to just get one file to make sure? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PerryRaptor Posted January 23, 2007 Author Share Posted January 23, 2007 Permissions are not an issue...I can UL, DL, MD, RD etc $FileInfo = _FtpFileFindFirst($Conn, $ftpfolder & $ftpfilemask, $Handle, $DllRect) If $FileInfo[0] Then $i=1 Do $dl_file[$i] = $FileInfo[10] $FileInfo = _FtpFileFindNext($Handle, $DllRect) $i = $i+1 Until Not $FileInfo[0] EndIf If I set a value for $i in $DL_file[$i] greater than the number of files on the server all is fine If I attempt to dynamically fill $DL_file array with file names on the fly I run into trouble. Link to comment Share on other sites More sharing options...
Zedna Posted January 24, 2007 Share Posted January 24, 2007 Permissions are not an issue...I can UL, DL, MD, RD etc$FileInfo = _FtpFileFindFirst($Conn, $ftpfolder & $ftpfilemask, $Handle, $DllRect) If $FileInfo[0] Then $i=1 Do $dl_file[$i] = $FileInfo[10] $FileInfo = _FtpFileFindNext($Handle, $DllRect) $i = $i+1 Until Not $FileInfo[0] EndIfIf I set a value for $i in $DL_file[$i] greater than the number of files on the server all is fine If I attempt to dynamically fill $DL_file array with file names on the fly I run into trouble.You need to ReDim $dl_file[$i]ReDim $pole[UBound($$dl_file)+1] $dl_file[$i] = $FileInfo[10]Also in your example you have not declared $dl_file[] Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PerryRaptor Posted January 24, 2007 Author Share Posted January 24, 2007 How often must I ReDim? I tried _ArrayPush(), but it didn't work either. I'll try ReDim Link to comment Share on other sites More sharing options...
Zedna Posted January 24, 2007 Share Posted January 24, 2007 How often must I ReDim? I tried _ArrayPush(), but it didn't work either. I'll try ReDimSearch forum for examples of Redim ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PerryRaptor Posted January 25, 2007 Author Share Posted January 25, 2007 (edited) $i=1 Dim $dl_file[2]; there are 8 files on the FTP server right now but more are on the way $FileInfo = _FtpFileFindFirst($Conn, $ftpfolder & $ftpfilemask, $Handle, $DllRect) If $FileInfo[0] Then Do $dl_file[$i] = $FileInfo[10] $FileInfo = _FtpFileFindNext($Handle, $DllRect) Redim $dl_file[UBound($dl_file,1)+1] $i = $i + 1 Until Not $FileInfo[0] EndIf _ArrayDisplay($dl_file,"FTP Server Files") Okay...It is fixed... Edited January 25, 2007 by PerryRaptor Link to comment Share on other sites More sharing options...
PerryRaptor Posted January 26, 2007 Author Share Posted January 26, 2007 Here is the whole potato...Get FTP Server file names into a single dimension array, count the number of files, and download them. I like .ini files so here is the one I used. <instructions go here> ...THIS WILL OVERWRITE EXISITING FILES WITHOUT WARNING...look closely at the settings below... <end instructions> [SERVER] Server=upload.comcast.net UserName=************* Password=************** FileFolder=WorkFolder/Projects/ FileMask=*.* LocalFolder=C:\WorkFolder\Projects [BATTLE] ShowFileCount=7 expandcollapse popup#include <C:\program files\autoit3\include\Ftp.au3> #include <C:\program files\autoit3\include\Array.au3> ; lets read in values and settings needed for FTP operations $FTPconfig = "FTP_DL.ini" $FTPserver = IniRead($FTPconfig, "SERVER", "Server", "NotFound") $FTPuser = IniRead($FTPconfig, "SERVER", "UserName", "NotFound") $FTPpass = IniRead($FTPconfig, "SERVER", "Password", "NotFound") $FTPfolder = IniRead($FTPconfig, "SERVER", "FileFolder", "NotFound") $FTPfilemask = IniRead($FTPconfig, "SERVER", "FileMask", "*.*") $LocalFolder = IniRead($FTPconfig, "SERVER", "LocalFolder", "NotFound") $FileCount = IniRead($FTPconfig, "BATTLE", "ShowFileCount",5) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else MsgBox(4096, "in-the-blind FTP file download", "FTP Server: " & $FTPserver & @CRLF & "UserName: " & $FTPuser & @CRLF & "Password: " & $FTPpass & @CRLF & "From FTP Path: " & $FTPfolder & @CRLF & "To Local Path: " & $LocalFolder) EndIf ; setup FTP Operations $dllhandle = DllOpen('wininet.dll') $Open = _FTPOpen('ftp'); I roll with Comcast so this is all I need here $Conn = _FTPConnect($Open, $FTPserver, $FTPuser, $FTPpass) Dim $Handle Dim $DllRect $l_Flags = 2; Binary Download mode $l_Fail = 0; Overwite local files is OK $l_Attributes = 0; I don't know what this is for $l_Context = 0; no callbacks required $i=1 Dim $dl_file[2]; there are more files on the FTP server right now--the array can grow larger as needed ;lets create a single dimension array with file names from the FTP Server $FileInfo = _FtpFileFindFirst($Conn, $ftpfolder & $ftpfilemask, $Handle, $DllRect) If $FileInfo[0] Then Do $dl_file[$i] = $FileInfo[10] $FileInfo = _FtpFileFindNext($Handle, $DllRect) Redim $dl_file[UBound($dl_file,1)+1] $i = $i + 1 Until Not $FileInfo[0] EndIf ; need to delete the last {empty} element Redim $dl_file[UBound($dl_file,1)-1] ; store the file count in element [0] of the array holding the file names $dl_file[0] = UBound($dl_file)-1 _ArrayDisplay($dl_file,"FTP Server Files") ; now to download the files $i=1 For $i = 1 to $FileCount; or you can use $dl_file[0] if you want to download everything $file_dl = $dl_file[$i] $FTP_DL = _FTPGetFile($Conn, $ftpfolder & $file_dl, $LocalFolder & "\" & $file_dl, $l_Flags, $l_Fail, $l_Attributes, $l_Context) Next ; close up resources used _FtpFileFindClose($Handle, $DllRect) _FTPClose($Open) DllClose($dllhandle) MsgBox(0,"FTP Server Download","Download Complete --> " & $dl_file[0] & " files should be there") Tomorrow, I will reverse the process...Upload from local computer to FTP server. sendme 1 Link to comment Share on other sites More sharing options...
sendme Posted November 25, 2016 Share Posted November 25, 2016 Tomorrow, I will reverse the process...Upload from local computer to FTP server. Link to comment Share on other sites More sharing options...
sendme Posted November 25, 2016 Share Posted November 25, 2016 Tomorrow, I will reverse the process...Upload from local computer to FTP server.?? Now Please !! Link to comment Share on other sites More sharing options...
Developers Jos Posted November 25, 2016 Developers Share Posted November 25, 2016 4 hours ago, sendme said: Now Please !! Not sure what you want to tell us but : Sounds like you are not very patient. You are resurrecting an 10 year old thread and your question is supposed to be related? Your question is totally unclear so try to explain this better what it is you are trying to do. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now