Sia Posted March 30, 2009 Share Posted March 30, 2009 Please could not you explain why I can not get repeated updates using _FTPFilesListToArray function: script fragment: #include <WindowsConstants.au3> #include <FTP_ex.au3> $Open_ftp = _FTPOpen('MyFTPControl') $FTP = _FTPConnect($Open_ftp, "IPaddress", "username", "password") $s_Remote ='/ftproot/ObjectID/' _FtpSetCurrentDir($FTP, $s_Remote) $file_names = _FTPFilesListToArray($FTP, 2) _ArrayDisplay($file_names) _FTPClose('MyFTPControl') ; 2 -------------------------------------------------------------- $Open_ftp2 = _FTPOpen('MyFTPControl') $FTP2 = _FTPConnect($Open_ftp2, "IPaddress", "username", "password") $s_Remote2 ='/ftproot/ObjectID' _FtpSetCurrentDir($FTP2, $s_Remote2) $file_names2 = _FTPFilesListToArray($FTP2, 2) _ArrayDisplay($file_names2) *** I get array with files names once, starting script only, but if I do something with files on ftp server after part 1 and before part 2 - add, remove, rename files with working script, the second part of it returns with function _FTPFilesListToArray old data (repeats the same got at the beginning). I must restart script to get updated info from ftp server. Where is my mistake? Thank you. Link to comment Share on other sites More sharing options...
martin Posted March 30, 2009 Share Posted March 30, 2009 Please could not you explain why I can not get repeated updates using _FTPFilesListToArray function:script fragment:#include <WindowsConstants.au3>#include <FTP_ex.au3>$Open_ftp = _FTPOpen('MyFTPControl')$FTP = _FTPConnect($Open_ftp, "IPaddress", "username", "password")$s_Remote ='/ftproot/ObjectID/'_FtpSetCurrentDir($FTP, $s_Remote)$file_names = _FTPFilesListToArray($FTP, 2)_ArrayDisplay($file_names)_FTPClose('MyFTPControl') ; 2 -------------------------------------------------------------- $Open_ftp2 = _FTPOpen('MyFTPControl')$FTP2 = _FTPConnect($Open_ftp2, "IPaddress", "username", "password") $s_Remote2 ='/ftproot/ObjectID'_FtpSetCurrentDir($FTP2, $s_Remote2)$file_names2 = _FTPFilesListToArray($FTP2, 2)_ArrayDisplay($file_names2)***I get array with files names once, starting script only, but if I do something with files on ftp server after part 1 and before part 2 - add, remove, rename files with working script, the second part of it returns with function _FTPFilesListToArray old data (repeats the same got at the beginning).I must restart script to get updated info from ftp server.Where is my mistake?Thank you.I don't see the mistake. I don't have the _FTPFilesListToArray function in the udf I use, though I have my own function FTPListFilesmg which returns an array of 2 elements. The first elemnt has a list of folders with their dates and times,and the second element has a list of files with their dates and times. It uses a dll call to WinInetto FtpFindFirstFile whic I imagine _FTPFilesListToArray does as well. However, if I change the files on the server and 'refresh' by calling FTPListFilesmg again it correct shows the current files and directories.If you want to try my function just ask and I'll post it but I don't see why it should make any difference, but who knows? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
t0nZ Posted November 9, 2010 Share Posted November 9, 2010 I don't know if this issue was solved but I have exactly the same problem ! No updates in the array ! Here is my code: Func testFTP() _GUICtrlListView_Destroy($listaFTP) $listaFTP = GUICtrlCreateListView("", 400, 270, 180, 125) $server = GUICtrlRead($inputFTP) $username = GUICtrlRead($inputuser) $pass = GUICtrlRead($inputpass) $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass, 1 ) If $Conn = 0 Then _GUICtrlListView_AddColumn($listaFTP, " * !!! FTP OFFLINE ??? *", 176) Else _FTP_DirSetCurrent($Conn, "/x/trans") $ftpFiles = _Ftp_ListToArray($Conn, 2) If $ftpFiles[0] = 0 Then _GUICtrlListView_AddColumn($listaFTP, "nessun file ", 176) Else _GUICtrlListView_AddColumn($listaFTP, "numero files: " & $ftpFiles[0], 176) For $i = 1 To UBound($ftpFiles) - 1 _GUICtrlListView_AddItem($listaFTP, $ftpFiles[$i], 0) Next GUISetState(@SW_SHOW) EndIf EndIf $Ftpc = _FTP_Close($Open) EndFunc ;==>testFTP No ideas ? I was thinking of shift to another UDF for FTP... Link to comment Share on other sites More sharing options...
t0nZ Posted November 9, 2010 Share Posted November 9, 2010 Solved ! I used the $INTERNET_FLAG_RESYNCHRONIZE flag . So the sintax is $ftpFiles = _Ftp_ListToArray($Conn, 2,$INTERNET_FLAG_RELOAD) and it is updating the file list. ..but in the manual this is not documented and i consider _Ftp_ListToArray not correct and or not finished for now. GreetZ 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