Identifying folders in listfiles(), and using recursion in Panorama

Greetings! I’m starting a task decades in the making: I’ve let the files on my various computers and external drives get out of hand, and need to consolidate and organize them. To this end, I want to create a relatively simple database of these files (for each file/folder: name, path, date last modified). I can do this for the contents of a single folder using choosefileDialog and listfiles(), but of course will need recursion to access the contents of folders within folders. I’ve run into two issues here.

The first is: how do you reliably identify a folder as a file? In my sample runs, folder “filenames” as recorded in the listfiles() function do not have a suffix, so I can theoretically look for filenames that lack periods, but that seems like an untrustworthy hack.

The second, bigger issue, which probably is a “my brain is full” moment, is that I cannot work out how to set up a recursive procedure in Panorama that will create records for all the “files” in a folder, and, once I’ve identified the folders within that folder, repeat the process for each of those folders, and so on.

I suspect that this is well-traveled territory, but I would appreciate any guidance on either of these issues!


Check out the filecatalog( function. It will probably get you most of the way there in one statement.

Dave, thanks. That looks very much like what I need!