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

File.parentDir

$path.parentDir() -> Dir|null

Description

Returns the parent directory of the path.

The parent dir of the root directory is returned as null.

file'/dir1/dir2/file.txt'.parentDir()
//= dir'/dir1/dir2'

dir'/dirA/dirB/dirC'.parentDir()
//= dir'/dirA/dirB'

dir'/someDir'.parentDir()
//= dir'/'

dir'/'.parentDir()
//= null

See Also