Files using FolderItem

I am really confused with files in Xojo. I am trying to get a list of all csv files in a folder called “DailyReports” off of the current application folder. Everything I try just doesnt work, can someone point me in the right direction, thanks.

What do you have so far?

I can do the general file stuff but I cant work out have to tell it to get me the *.csv files list in the DailyReports folder. The following just returns me the folder itself in f.name

Dim f As new FolderItem f = GetFolderItem("DailyReports")

Right. The next step is to get a list of all the file names using f.Item( x ) in a loop. Build an array from that, filtering as you go.

dim fileList() as FolderItem
dim cnt as Integer = f.Count
for i as Integer = 1 to cnt
  dim thisFile as FolderItem = f.Item( i )
  if thisFile.Name.Right( 4 ) = ".csv" then
    fileList.Append thisFile
  end if
next i

Or something like that. :slight_smile:

Brilliant I was missing the following line, thanks for your help.

dim thisFile as FolderItem = f.Item( i )