Browse the docs

parsePath

Splits a file path into folder, name, stem, extension, exists and isFolder.

Details #

parsePath(text) expands a leading ~ and returns a record: folder (the path without the last part), name (report.final.pdf), stem (report.final), extension (pdf), exists and isFolder (read from the disk when the function runs).

Parameters #

Takes 1 argument. {{ parsePath(text) }}

Examples #

parsePath("~/Documents/report.pdf").name
→ report.pdf
parsePath("/tmp").isFolder
→ true

Gotchas #

  • It reads the disk for exists and isFolder, so a preview shows it as needing a real run.

  • A file with no dot has an empty extension.