Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

path exists for path

Check whether a path exists.

Signature

> path exists {flags}

Flags

  • --no-symlink, -n: Do not resolve symbolic links

Input/output types:

inputoutput
stringbool
list<string>list<bool>

Examples

Check if a file exists

> '/home/joe/todo.txt' | path exists
false

Check if files in list exist

> [ /home/joe/todo.txt, /home/doe/todo.txt ] | path exists
╭───┬───────╮
│ 0 │ false │
│ 1 │ false │
╰───┴───────╯

Notes

This only checks if it is possible to either open or cd to the given path. If you need to distinguish dirs and files, please use path type. Also note that if you don't have a permission to a directory of a path, false will be returned