Here is a revised solution that will open each folder containing one or more .mp3 files as individual Finder windows, and then with a keyboard shortcut, you can tell Finder to cascade these open windows in an orderly fashion. You can then cycle through these windows using cmd+backtick (`), and close all of them with another single keystroke (option+cmd+W).
You want to open Apple's Script Editor via (Dock : Launchpad : Other : Script Editor. Copy and paste the following code into the Script Editor, click the hammer icon to compile the copied code, and then you want to do these in order:
- Initially save the script source via File > Save
- File format: Text
- Line Endings: macOS
- Save As: main.applescript
- Location: Desktop
- Option+Save As…
- File Format: Application
- Save As: main.app
- Locaation: Desktop
- Options: none
- Once you have saved this application, drag and drop it to your Dock just to the left of the last | separator.
- In Finder View menu, select Show Path Bar
Code source:
(*
main.applescript
This script cannot be run from the Script Editor. It must be saved as
an application that sits in your Dock, so when you select the source
folder in the Finder, it remains selected. A single-click of this
app in the Dock will open one Finder window per found folder
containing an .mp3 audio file.
Initially, this will spray Finder windows around the Desktop, but one
can cascade them by pressing the option key and choosing
"Arrange in Front" from the Finder Window menu.
Cascaded windows can be cycled through by clicking cmd+` (back tick),
and all open Finder windows can be closed at once by option+cmd+W.
*)
use scripting additions
tell application "Finder"
if selection is {} then return
set selFolder to (selection as text) as alias
if not kind of selFolder is "Folder" then return
set selFolder to POSIX path of selFolder
-- recursively return list of folders containing .mp3 files beneath original selection
set mp3_fold to paragraphs of (do shell script "/bin/zsh -s <<'EOF' - " & selFolder & "
typeset -a dirs=()
dirs=( ${1}/**/*.(mp3)(.N) )
print -l ${dirs:h}
EOF")
-- get the folder paths in HFS file format so reveal will work on them
repeat with i from 1 to (the count (mp3_fold as list))
try
set item i of mp3_fold to (((item i of mp3_fold as text) as POSIX file) as alias)
on error errmsg number errnum
display dialog errnum & ": " & errmsg
end try
end repeat
reveal mp3_fold
end tell
return
You will need to preselect the folder you want to process before single-clicking the app in the Dock. The next event will be be found folders opened in separate windows on your Desktop. This is where you press the option key and from the Finder Window menu, you choose Arrange in Front. This triggers the organized cascade of overlapping Finder windows. Each window will have the full path displayed at the bottom of the window to the folder in it. During the same login session, the Finder remembers you were using a cascade and subsequent .mp3 folder selections are presented in a cascade too.
You can rotate through the individual cascaded Finder windows using cmd+backtick (`) and close all of the cascaded windows with just a option+cmd+w keystroke.
Tested: macOS Ventura 13.4.1 (c).