nushell/docs/commands/path-dirname.md
Fernando Herrera dbcadbc12c moved folders
2022-02-07 19:23:12 +00:00

697 B

path dirname

Get the parent directory of a path

Usage

> path dirname ...args {flags} 

Parameters

  • ...args: Optionally operate by column path

Flags

  • -h, --help: Display this help message
  • -r, --replace : Return original path with dirname replaced by this string
  • -n, --num-levels : Number of directories to walk up

Examples

Get dirname of a path

> echo '/home/joe/code/test.txt' | path dirname

Walk up two levels

> echo '/home/joe/code/test.txt' | path dirname -n 2

Replace the part that would be returned with a custom path

> echo '/home/joe/code/test.txt' | path dirname -n 2 -r /home/viking