houseonfire Posted November 27, 2007 Share Posted November 27, 2007 (edited) $sPath = @MyDocumentsDir&"\My Received Files\" $results = _FileFind($sPath, "*.xml", 1) If @error = 3 Then MsgBox(48, "Attention", "No files found.") Endif $ftpIP = '??????' $ftpUser = '??????' $ftpPass = '??????' ;Open FTP Session $dllhandle = DllOpen('wininet.dll') $Session = _FTPOpen("FTP") if @error then MsgBox(16,"Error","FTP Session Failed to open.") DllClose($dllhandle) Exit EndIf ;Connect to FTP server $ftpSession = _FTPConnect($Session,$ftpIP,$ftpUser,$ftpPass,0,1,0x08000000) if @error then MsgBox(16,"Error","FTP Connection Failed" & @cr & "Please check you connection and FTP Settings") _FTPClose($Session) DllClose($dllhandle) Exit EndIf ;Send the files $arraylist = _ArrayCreate ($results) _FTPPutFile ($ftpSession ,$arraylist, "/www/images",1) Yeah.. Well I need to be able to upload all my chat logs to my FTP server. But I have to do it not knowing the direct path. As some of you know, MSN uses random numbers after your username, and the chat logs usernames. I cannot know these random numbers, and all the logs have to be uploaded. I am trying to use it with an array, but I don't know what I am doing wrong. When I try i get the returning number of "0", which on the FTP file, says its incomplete, or error or whatever you want to call it. Whatever it is, it means it didn't work. If anyone can help me out with this, that would be kick ass. Thanks. Edited November 27, 2007 by houseonfire Link to comment Share on other sites More sharing options...
gamerman2360 Posted November 27, 2007 Share Posted November 27, 2007 What about using _FileListToArray and useing a For loop with that result on _FTPPutFile? I don't know what _FTPPutFile or _FileFind does, but all _ArrayCreate is doing is putting $results in a single element array. : \ Dosn't really help anything. Link to comment Share on other sites More sharing options...
houseonfire Posted November 27, 2007 Author Share Posted November 27, 2007 I tried that and still get the 0 Link to comment Share on other sites More sharing options...
Developers Jos Posted November 27, 2007 Developers Share Posted November 27, 2007 I think you are trying to upload all found xml files, but $results in your example will contain the handle to the FileFindFirst(). You will need to retrieve all filenames with FileFindNext() and then upload them with: _FTPPutFile ($ftpSession ,$Filename, "/www/images/"&Filename) 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...
houseonfire Posted November 27, 2007 Author Share Posted November 27, 2007 (edited) Thank you. I was kinda hoping I didn't have to go into the FileFindNext() stuff because I have no clue how to use it. But now is as good a time as any to learn. Edited November 27, 2007 by houseonfire Link to comment Share on other sites More sharing options...
Developers Jos Posted November 27, 2007 Developers Share Posted November 27, 2007 (edited) You could make life easy by using _FileListToArray() which will create an Array with filenames for you after which you only have to For-Next loop through the list.. Jos Edited November 27, 2007 by 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...
houseonfire Posted November 27, 2007 Author Share Posted November 27, 2007 So each file would have an array name, and id just have to loop through those? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 27, 2007 Developers Share Posted November 27, 2007 So each file would have an array name, and id just have to loop through those?Base example: #include <File.au3> $FileList = _FileListToArray("C:\Temp" , "*.xml") If @error Then MsgBox(0, "", "No Files\Folders Found.") Exit EndIf For $x = 1 to $FileList[0] ConsoleWrite($FileList[$x] & @CRLF) Next 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...
houseonfire Posted November 27, 2007 Author Share Posted November 27, 2007 Thank you very much. I still cant get it to work, but I'm close haha. Link to comment Share on other sites More sharing options...
houseonfire Posted November 27, 2007 Author Share Posted November 27, 2007 (edited) ERROR Subscript used with non-Array variable.: For $x = 1 to $FileList[0] For $x = 1 to $FileList^ ERROR I get that with $FileList=_FileListToArray(@MyDocumentsDir&"\My Received Files\", "*.xml") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf For $x = 1 to $FileList[0] ConsoleWrite($FileList[$x] & @CRLF) Next _FTPPutFile ($ftpSession ,$FileList, "/www/") If @error Then MsgBox(0,"_FTPPutFile @error",@error) EndIf I feel like I'm missing something sooo simple and stupid.. Edited November 27, 2007 by houseonfire Link to comment Share on other sites More sharing options...
Developers Jos Posted November 28, 2007 Developers Share Posted November 28, 2007 Try: (Made 2 changes in your code. $FileList=_FileListToArray(@MyDocumentsDir&"\My Received Files", "*.xml") If @Error Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf For $x = 1 to $FileList[0] ConsoleWrite($FileList[$x] & @CRLF) Next _FTPPutFile ($ftpSession ,$FileList, "/www/") If @error Then MsgBox(0,"_FTPPutFile @error",@error) EndIf 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...
houseonfire Posted November 28, 2007 Author Share Posted November 28, 2007 It's returning that no files were found.. If you want to help a little more that would be great. But you don't have to. Link to comment Share on other sites More sharing options...
houseonfire Posted November 28, 2007 Author Share Posted November 28, 2007 (edited) Ok.. Actually. Someone could help me out a little more... It keeps returning saying that no files were found, even if i give an absolute direct path..$FileList=_FileListToArray(@DocumentsCommonDir&"My Received Files\", "*.xml") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf For $x = 1 to $FileList[0] ConsoleWrite($FileList[$x] & @CRLF) Next _FTPPutFile ($ftpSession ,$FileList, "/www/") If @error Then MsgBox(0,"_FTPPutFile @error",@error) EndIf Edited November 28, 2007 by houseonfire Link to comment Share on other sites More sharing options...
Developers Jos Posted November 28, 2007 Developers Share Posted November 28, 2007 Now why do you think I put that loop in there ? Your FTP task has to go there too since you need to transfer one file at a time. Don't forget that the target file also needs to be defined. Something like: For $x = 1 to $FileList[0] ConsoleWrite($FileList[$x] & " tranferred to:" & "/www/"&FileList[$x] @CRLF) _FTPPutFile ($ftpSession ,$FileList[$x], "/www/"&FileList[$x]) If @error Then MsgBox(0,"_FTPPutFile @error",@error) EndIf Next 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...
houseonfire Posted November 28, 2007 Author Share Posted November 28, 2007 Thank you so much for your help and patience. It transfers now. Its not detecting xml files, but I can fix that 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