Recursive File Openings

I have a folder with several files in it. I would like to build a macro that recursively opens each file with a specified app (the same app for all the files), waits for the file to open and update if necessary, then closes that file when any update process is finished and moves on to the next file. Any suggestions are appreciated.

Hey William,


Welcome to the forum!  :sunglasses:


Please be more specific.

  • What's the folder/file hierarchy like?
  • What specified app(s)?
  • What kind of update?

-Chris

Start by writing a macro that does what you want for one, selected, file. Then take a look at the "For Each" action -- while it isn't obvious from that page, when you use "For Each" over "items in a directory" you have the option to do so "recursively":

image

Thanks.
The folder contains old iPhoto libraries and Photos libraries that need to be updated to the current version of Photos. So the app is Photos in Ventura 13.2. When you double click the library file name/icon the update process (the library's internal database of photos and metadata) starts.

Depending on the size of the library, the number of photos, and the connection speed to the external drive it can take hours to complete. So one of the challenges is for Keyboard Maestro to be able to know when the update process has been completed so it can move on to the next library.

Hope this clarifies the situation.

This might be possible by looking at the state of menus in Photos. Presumably while the updating process is going on, certain menu items (maybe all menu items) in Photos would not be enabled and Keyboard Maestro can pause until menu items become enabled. So yes, I think it's possible.

But I would strongly advise you not to try and automate this process. Photos Libraries are just too important to risk corrupting if the Macro that you have written, tripped up in some way. The very fact that you say the updating is taking hours per Library suggests a lot of photos are stored in those Libraries which also suggests those libraries are very important.

1 Like

Given this risk I think it best to test the macro on a copy of several libraries first and see if there are any problems. Thanks for your comments.

1 Like