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 split for path

Split a path into a list based on the system's path separator.

Signature

> path split {flags}

Input/output types:

inputoutput
stringlist<string>
list<string>list<list<string>>

Examples

Split a path into parts

> '/home/viking/spam.txt' | path split
╭───┬──────────╮
│ 0 │ /        │
│ 1 │ home     │
│ 2 │ viking   │
│ 3 │ spam.txt │
╰───┴──────────╯

Split paths in list into parts

> [ /home/viking/spam.txt /home/viking/eggs.txt ] | path split
╭───┬──────────────────╮
│ 0 │ ╭───┬──────────╮ │
│   │ │ 0 │ /        │ │
│   │ │ 1 │ home     │ │
│   │ │ 2 │ viking   │ │
│   │ │ 3 │ spam.txt │ │
│   │ ╰───┴──────────╯ │
│ 1 │ ╭───┬──────────╮ │
│   │ │ 0 │ /        │ │
│   │ │ 1 │ home     │ │
│   │ │ 2 │ viking   │ │
│   │ │ 3 │ eggs.txt │ │
│   │ ╰───┴──────────╯ │
╰───┴──────────────────╯