go_walk

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 7 Imported by: 3

README

go-walk

A directory tree parser

Instillation

go get github.com/akshaybabloo/go-walk

Usage

package main

import (
    "fmt"
    walk "github.com/akshaybabloo/go-walk"
)

func main() {
    dirStats, err := walk.ListDirStat("/", "node_modules")
    if err != nil {
        panic(err)
    }
    fmt.Println(dirStats)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryInfo

type DirectoryInfo struct {
	Path            string    // Absolute path of the directory.
	Size            int64     // Size of the directory in bytes.
	CreationTime    time.Time // When the directory was created.
	LastModified    time.Time // When the directory was last modified.
	NumberOfFiles   int       // Number of files in the directory.
	NumberOfSubdirs int       // Number of subdirectories within the directory.
}

DirectoryInfo holds metadata about a directory.

func ListDirStat

func ListDirStat(dirPath string, keywords ...string) ([]DirectoryInfo, error)

ListDirStat lists directories matching the provided keywords in dirPath and returns their metadata. If no keywords are provided, all directories are matched. Returns aggregated errors if they occur.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL