This commit is contained in:
Jan Bader 2020-11-21 17:51:00 +01:00
commit ccb42c7e29
2 changed files with 40 additions and 0 deletions

BIN
dupe-finder.exe Normal file

Binary file not shown.

40
main.go Normal file
View File

@ -0,0 +1,40 @@
package main
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
"os"
)
func main() {
for _, path := range os.Args[1:] {
fmt.Println(path)
}
}
type filesMap struct {
Files map[int]map[[32]byte]*fileEntry
}
type fileEntry struct {
Path string
Size int
}
func calculateHash(path string) (string, error) {
f, err := os.Open(path)
if err != nil {
return "", err
}
defer f.Close()
h := sha256.New()
if _, err := io.Copy(h, f); err != nil {
return "", err
}
return base64.RawStdEncoding.EncodeToString(h.Sum(nil)), nil
}