https://github.com/oderwat/iwalkdeep
Go "Iterator" which walks directory entries in a bottom to top order
https://github.com/oderwat/iwalkdeep
Last synced: 10 months ago
JSON representation
Go "Iterator" which walks directory entries in a bottom to top order
- Host: GitHub
- URL: https://github.com/oderwat/iwalkdeep
- Owner: oderwat
- License: apache-2.0
- Created: 2013-11-19T21:53:19.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-10-27T15:45:23.000Z (over 9 years ago)
- Last Synced: 2025-08-23T07:14:51.228Z (10 months ago)
- Language: Go
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iwalkdeep
--
import "github.com/oderwat/iwalkdeep"
The package "ideepwalk" helps to iterates over all directories in a give path in
bottom to top order. This is helpfull in many use cases where you for example
want to clean up empty directories after processing/moving files in the
hierarchie.
As speciality the packaged exposes this functionality also as an easy to use
iterator like in the following example
for dir := range IWalkDeep("/homes") {
fmt.print(dir)
}
## Usage
#### func IWalkDeep
```go
func IWalkDeep(root string) <-chan string
```
This is the "Iterator" which can eaasily be used for dir := range
IWalkDeep(path) {}
#### func WalkDeep
```go
func WalkDeep(root string, fun WalkDeepFunc)
```
Walk all directories in root from bottom to top calling WalkDeepFunc for every
encountered directory
#### type WalkDeepFunc
```go
type WalkDeepFunc func(dir string)
```
This function is called by WalkDeep for each directory on its way up to the root
of the given path
_(made with godocdown)_