How to Get a List of All Subfolders (And Pick One)?

I'm trying to (1) get and display a list of all subfolders of a folder and (2) select one of them for further use (I want it to be the target of a move action).

What am I doing wrong here, by using the append action? (Only the first subfolder is displayed.)

The function of the break from loop action is to stop the search as soon as any folder has been found.

That was useful when simply detecting whether a folder had any subfolders, but here you don't need that break from loop action – you can just delete it.

1 Like


Chosen subfolder, if any ?.kmmacros (21.0 KB)

1 Like

Hey Hans,

This macro presents the user with an AppleScript Choose-From-List dialog.


You can type-select the first few characters to go to the listed item.

I've added a reasonable amount of error-checking.

OUTPUT goes to the variable : local_MoveToFolderPath

Which is currently displayed in a text window at the end of the macro.


Pick-List of Subfolders in the Given Directory v1.00.kmmacros (14 KB)

1 Like

Why not just use the KM Prompt for File action where you change the option to "Choose Folder"?




Thank you! BTW: I had to change the last display action to 'Display text in a window', to get any message. (macOS 10.15.7, KM 9.2, Notifications enabled).

1 Like

That's right, the output value was just going into the clipboard – I wasn't sure what you wanted to do with it.

FWIW, now that JMichaelTX has pointed out to us that the Prompt for File Action has a Choose Folder option, it might simplify life to use that instead, unless you want any finer control over the UI behaviour.