I'm writing a script to help users install custom info panels in the Folder.userData + '/Adobe/XMP/Custom File Info Panels/3.0/panels' location. I have a working script to copy files, but I also want to delete previous versions of the same info panel. I also want to allow for the possibility that could be several older versions so I need to loop through them. I know that I need to empty the files of a folder before it can be removed. I can remove one instance of a ninfo panel, but not several - I'm having trouble getting the function to loop.

For example, if I have two old info panel version to delete (myPanel_v1 and myPanel_v2) can use getFiles (myPanel*) to get an array with the names of the two parent folders: