Simple duplicate file finder written in Go. Can be used to find identical files under a directory programmatically or via CLI.
Feel free to open issues for bugs, feature requests, improvements and missing tests.
Following Pull Requests will be appreciated!
go install github.com/ravilock/dedupgo@latest
Dedupgo can be used with CLI
dedupgo find directory-path
This will iterate over the files in the passed directory looking for files that have the same content
dedupgo find directory-path -r
This will recursively search through all sub-directories of the passed directory looking for files that have the same content, this option will only stop when there are not sub-directories left
dedupgo find directory-path -d 4
This works similarly to recursive but will define a sub-directory depth limit, this will only dive to the 4-th directory depth
Use in your Go project:
go get github.com/ravilock/dedupgo/dedup
- Uses Go modules to manage dependencies.
import (
"fmt"
"github.com/ravilock/dedupgo/dedup"
)
func main() {
result, err := dedup.Find("/home/raylok/projects/dedupgo-test")
if err != nil {
fmt.Println(err)
return
}
for hash, value := range result {
fmt.Printf("%s are duplicated files under hash %q\n", value, hash)
}
}