path type

For path.

Get the type of the object a path refers to (e.g., file, dir, symlink).

Command Type

built-in

Signature

> path type {flags}

Input/output types:

input output
string string
list<string> list<string>

Examples

Show type of a filepath.

> '.' | path type
dir

Empty string is not a path.

> '' | path type | is-empty
true

Show type of filepaths in a list.

> ls | get name | path type

Notes

This checks the file system to confirm the path’s object type. If the path does not exist, null will be returned.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.