- Published on
Today I Learnt: Extract dirname from a path
- Authors

- Name
- Mehdi Akiki
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