Having Xojo scan all files with folders / subfolders

Hi everyone -

Just learning to program with XOJO - have a newbie question.

I’m working on a simple filing app that will scan all the files within a folder, get each graphic file’s location and metadata, and log that data into a database. I’m tackling each step one by one, and got stumped on the first stage. (figures!)

I managed to create a pop up window that will only let you select graphic files that are JPEG and PNG, and select them, but I’m wondering how do I have XOJO scan a selected folder or subfolder?

If someone could point me in the right direction to scanning folders, that would be great.
Any input on the other stages would be awesome.

Here’s some of the code:

[code]//set variables
Dim SelectFilesDialogBox As New OpenDialog
Dim jpegType as New FileType
Dim pngType As New FileType

//set file types available in dialog box
jpegType.Name = “image/jpeg”
jpegType.MacType = “JPEG”
jpegType.Extensions = “jpg;jpeg”
pngType.Name = “image/png”
pngType.MacType = “PNGf”
pngType.Extensions = “.png”

//set dialog box characteristics
SelectFilesDialogBox.ActionButtonCaption = “Select Files”
SelectFilesDialogBox.CancelButtonCaption = “Cancel”
SelectFilesDialogBox.SuggestedFileName = “”
SelectFilesDialogBox.Title = “Select Files”
SelectFilesDialogBox.PromptText = “Select Files to Scan”
SelectFilesDialogBox.MultiSelect = True
//set initial directory - set this later to remember last used folder
SelectFilesDialogBox.InitialDirectory = SpecialFolder.Documents
SelectFilesDialogBox.Filter = jpegType + pngType[/code]

Edit (Paul): Formatted code as per Post Formatting Tips

To ask the user to choose a master folder, use:

Recursion is the way to go.

Running time depends on the number of files and nester folders (running platform too).

To that point…maybe use a Thread to keep the UI responsive.

Daniel: the consuming time still exists…

Years ago, I used AppleScripts for simple / small tasks. I stopped to use it (in Xojo favor) because it was so slow when running on files (take files, report names, extension, size, kind, etc. into a simple text file, but on a single source folder… 20 to 30 minutes for 1,000 files…).

Here is a project I shared some times ago:


Drop a folder (or a disk) in the front Window to get its contents. Click in the disclosure triangle to expand the folder contents.

This may be a good start (I hope).

This is great - thanks to you both. Going to take a look into both these directions.