michaelslamet Posted July 24, 2013 Share Posted July 24, 2013 I know how to read a list of files on specific folder on a local/network drive and put it in a array, but how to do the same on a specific folder on a webserver? PS: doesn't want to open any browser/window to do that Link to comment Share on other sites More sharing options...
Solution kylomas Posted July 24, 2013 Solution Share Posted July 24, 2013 (edited) michaelslamet, This is how I list files from a specific directory at my WEB server... expandcollapse popupFunc display_remote_files() $file_count = 0 GUICtrlSetData($lbl020,'Finding remote files...please wait...') GUICtrlSetData($edt010,'') Local $server = '*********************' Local $username = '********' Local $pass = '********' Local $Open = _FTP_Open('Samolyk FTP') If $open = 0 Then l(' FTP Open Error - Error code = ' & @error & _WinAPI_GetLastErrorMessage()) Exit endif Local $Conn = _FTP_Connect($Open, $server, $username, $pass) If $conn = 0 Then l(' FTP Connect Error - Error code = ' & @error & _WinAPI_GetLastErrorMessage()) exit endif Local $hfl Local $a_files = _FTP_findfilefirst($conn,"/www/klms/",$hfl) If @error = -1 Then GUICtrlSetData($lbl020,$file_count & ' files available for download...') Return endif GUICtrlSetData($edt010,$a_files[10] & @crlf, 1) $file_count += 1 While 1 $a_files = _ftp_findfilenext($hfl) If @error = -1 Then exitloop EndIf GUICtrlSetData($edt010,$a_files[10] & @crlf, 1) $file_count += 1 wend GUICtrlSetData($lbl020,$file_count & ' file(s) available for download...hit "DOWNLOAD FILES" to start download...') _ftp_findfileclose($hfl) Local $Ftpc = _FTP_Close($Open) If $ftpc = 0 Then l(' FTP CLose Error = ' & @error & @LF & _WinAPI_GetLastErrorMessage()) exit EndIf endfunc There are other, better FTP* functions that I was unaware of when I wrote this (see Help file). kylomas Edit: Obviously this is part of a script so the GUI references and references to function L() don't make sense. If the FTP functions are not clear I'll post the entire script. Edit2: A better example is right in the Help file under _FTP_ListToArray. Edited July 24, 2013 by kylomas michaelslamet 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
michaelslamet Posted July 24, 2013 Author Share Posted July 24, 2013 Kylomas, thanks a lot I'm going to see that, _FTP_ListToArray seems promising. Thanks again! 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