Creating Playlist For All Media Files Inside Folder?

I'm attempting to create a macro that aggregates all media files (which for me are mp3 and mp4 files) for a selected folder, including subfolders. Initially attempted an automator service but now attempting to save all multimedia files in the folder / subfolder to a proper playlist.m3u file.

Even though I echo the %Variable%FinderFolder% to make sure it's ok, it doesn't seem to make it to the actual shell script.

/var/folders/kr/gjfkj42d31j5nyvmy56x9slh0000gn/T/Keyboard-Maestro-Script-5860BA69-6793-4F33-832F-140C8D2BA410: line 1: %Variable%FrontFolder%/_playlist.m3u: No such file or directory

I'm using the Get Finder Path addon and also realize there's another discussion on retrieving finder / folder paths.

Create Playlist.kmmacros (3.3 KB)

Hey There,

You’re misunderstanding how to use KM variables in the shell (as opposed to KM-text-fields).

find "$KMVAR_FrontFolder" -type f -iname "*.mp[34]"

The variable above is quoted, because of the risk of embedded spaces in OSX paths.

See the Executing Scripts section of the Keyboard Maestro documentation.

http://www.keyboardmaestro.com/documentation/7/keyboardmaestro.pdf

-Chris

1 Like