FormatPATH - LFORMAT-like formatting of paths

Usage: "PATH" "FORMAT"

formatpath is a script that takes a path as input and can modify it in

different ways. It can remove the extension, get the volume/device-name,

add a trailing slash and more.

NOTE: Both arguments needs citations around them, due to Arexx crappy

  handling of arguments.

The formatting that can be used are the following:

%D - Device/Volume-name

%P - Path (without device) up until the last slash

%F - Filename including extension if present

%E - Extension including the leading dot (ie .lha)

%N - Filename without extension

%X - Extension without the leading dot (ie lha)

%U - The entire inputted path unmodified

%S - This special string adds a trailing slash if the character before is

  not a slash or a colon, can be used with %U to make sure a path has

  a trailing slash unless it's a device or already has a trailing slash.

Examples:

1> formatpath "SYS:S" "%U%S"

SYS:S/

1> formatpath "Work:Music/Protracker/" "%D"

Work:

1> formatpath "comm/term/ncomm306.lha" "http://aminet.driar.se/%P%N.readme"

http://aminet.driar.see/comm/term/ncomm306.readme

1> formatpath "Download:Archived/AwesomeGame.lha" "%X"

lha

Proxy Information
Original URL
gemini://uhc.driar.se/help/formatpath
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
72.193213 milliseconds
Gemini-to-HTML Time
0.732024 milliseconds

This content has been proxied by September (ba2dc).