I have the following very neat code to get the names of the files on an ftp server
When I open the database and run the code, the correct file list is returned. If, whilst the database is open, I add or delete a file on the server and rerun the code then the original file list is returned. If I close / open the database and run the code the correct list is returned.
It is almost as though the files names on the first run are kept in cache/memory and the cache/memory is returned, without being updated.
Do I need to add code to clear the cache/memory?
Many thanks
Code:
Dim myFolderItem As FolderItem
Dim myFiles As String
GetFTPDetails
myFiles = ""
For Each myFolderItem In ftpList(pubInternetDomainName & "/" & pubWebOrderDownloadOrdersFromInternetFolder & "/", pubInternetFTPUserName, pubInternetFTPPassword) 'Each item could be a folder or a file
'Debug.Print myFolderItem.Name ', myFolderItem.IsFolder Is it a folder?
myFiles = myFiles & myFolderItem.Name & ";"
Next
Me.lstAvialableFilesForDownload.RowSource = myFiles
It is almost as though the files names on the first run are kept in cache/memory and the cache/memory is returned, without being updated.
Do I need to add code to clear the cache/memory?
Many thanks