An open API service indexing awesome lists of open source software.

https://github.com/maa3x/ppath

A robust and expressive suite of utilities for handling file system paths with ease
https://github.com/maa3x/ppath

filepath filesystem fs golang path

Last synced: 5 months ago
JSON representation

A robust and expressive suite of utilities for handling file system paths with ease

Awesome Lists containing this project

README

          

# Path Utility Library

This Go library provides a robust and expressive suite of utilities for handling file system paths with ease. Building on the standard path/filepath package, it introduces a set of intuitive, chainable methods that simplify file and directory operations such as path manipulation, pattern matching, directory traversal, and more. With this library, developers can effortlessly perform common file operations in a clean, readable style, making it ideal for projects that require efficient and flexible file system interactions.

## Installation

To install the library, use `go get`:

```sh
go get github.com/maa3x/ppath
```

## Usage

Here is a quick example of how to use the library:

```go
package main

import (
"fmt"
"log"

"github.com/maa3x/ppath"
)

func main() {
p := path.New("/Users/matrix/Code/go/projects")
p = p.Join("path", "README.md")

if !p.IsExist() {
log.Fatal("README.md not found!")
}

p2 := p.NthParent(2).Join("clone")
if err := p.Dir().Copy(p2); err != nil {
log.Fatal(err)
}
}
```