Get Path without filename

Hello!
I am new to scripting with dopus and have a small question:

I want to convert all selected images to another format with Imagemagick. This works fine but I also want to create a new folder inside the current directory where the images will end up.

I have already looked at the documentation: https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Codes_for_passing_filenames.htm

However, I can't figure out how to get just the file path without the filename to create the new folder in the correct place.

Code:

@runmode:hide
@filesonly
CreateFolder "output-webp-{date|MM-dd-yyy}-{time|HH-mm-ss}"
magick convert {filepath} {filepath|noext}.webp

Thanks for the help!

Translated with DeepL Translate: The world's most accurate translator (free version)

{filepath|..} will get you that.

Often, {sourcepath} will also be the same thing, but it can be different if you're viewing a list of files in multiple locations (e.g. Flat View or a File Collection).

Thank you!