Published on

Today I Learnt: Extract dirname from a path

Authors
  • Mehdi Akiki avatar
    Name
    Mehdi Akiki
    Twitter

Get directory name:

dirname /path/to/file.txt  # -> /path/to

Tip: combine with basename to split a path.

I build and scale reliable production systems. Open to full-time and freelance work with U.S.-based teams that value ownership and execution.

Got something in mind?

Book a Discovery Call