Version: v0.8.1 - Beta.  We welcome contributors & feedback.

File.withFileName

$file.withFileBase($withFileName) -> $newPath

Description

Create a new file path from the current file, with a new filename (including the extension).

$origFile = file'files:/dir/data.txt'

$zipFile = $origFile.withFileBase('archive.zip')
//= file'files:/dir/archive.zip'
                    ^^^^^^^^^^^

See Also