MacOS – Automator treating App Packages as folders

automatormacos

Automator treats .app files (Application Packages) as if they were folders. This might be useful in some instances, but for what I want to do – Periodically make a list of the contents of my Applications folder – it is extremely frustrating.

I just want a list of all the applications I have. I made a two step workflow, with "Get Folder Contents" and "New Text File". This would work perfectly, if not for the fact that I have a number of subfolders in the Applications folder with apps in there (for organization/sanity purposes).

In theory, this would be solved by checking the "Repeat for each subfolder found" option in the "Get Folder Contents" Action, but this gives me a huge problem: it lists every single file in each App Package, which I'm sure you'll understand is totally useless for my purposes.

Any Ideas?

Best Answer

Try this AppleScript:

tell application "Finder" to get name of every file of folder (path to applications folder)

Carlos figured this part out himself:

set appsPath to (path to applications folder)
tell application "Finder"

set appList to name of every application file of entire contents of folder appsPath end tell