Sign in to follow this  
Followers 0
koresho

Issues with FTPex.au3

3 posts in this topic

Hey there,

I searched the forum, but didn't see anything that had to do with this issue.

I'm creating a custom FTP interface for my company. Currently, I'm stuck on the issue that I cannot get the folder contents to refresh without completely exitting the script and connecting again. I am using _FTP_ListToArrayEx() to get the folder contents; this function does not appear to refresh the folder view when you call it a second time.

I already tried using _FTP_Close() and reestablishing the connection before attempting the refresh (to get a new session ID) but this did not help.

Any help is appreciated!

Func _UpdateFolder($folder) ;Update the contents of the provided DIR 
    _FTP_DirSetCurrent($FTP, $folder) ;Set the current directory to the new request
    $foldList = _FTP_ListToArrayEx($FTP, 0) ;This appears to be the problem area. This function doesn't actually gather more information from the server when it's called; it just reuses old data. 
    $ls = "3" ;ignore the . and .. that my server returns
    Do
        If $foldList[$ls][2] <> "16" Then ;If the item isn't a folder
            $size = "B"
            If $foldList[$ls][1] >= "1024" Then 
                $foldList[$ls][1] = $foldList[$ls][1] / "1024" ;turn >1024 bytes into KB
                $size = "KB"
            EndIf
            If $foldList[$ls][1] >= "1024" Then 
                $foldList[$ls][1] = $foldList[$ls][1] / "1024" ;turn >1024 kbytes into MB
                $size = "MB"
            EndIf
            $listVitem = GUICtrlCreateListViewItem($foldList[$ls][0] & "|" & $foldList[$ls][2] & "|" & Round($foldList[$ls][1], 2) & $size, $fListV)
        Else
            $listTitem = GUICtrlCreateTreeViewItem($foldList[$ls][0], GUICtrlRead($fTreeV)) ;Folders go in the treeview
        EndIf
        $ls = $ls + 1
    Until $ls > $foldList[0][0]
EndFunc

Share this post


Link to post
Share on other sites



try using the INTERNET_FLAG_RELOAD and INTERNET_FLAG_RESYNCHRONIZE as documented in the underlying FtpFindFirstFile function http://msdn.microsoft.com/en-us/library/aa384146(v=VS.85).aspx (which is called by _FTP_ListToArrayEx).

You are a savior. I completely forgot the flags existed, and your solution worked perfectly. Thanks so much!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0