Unique file finder
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
427 B

package main
import (
"flag"
"fmt"
"log"
"os"
)
func main() {
flag.Parse()
files := make(map[string]int)
for i, v := range flag.Args() {
f, err := os.ReadDir(v)
if err != nil {
log.Fatal(err)
}
for _, df := range f {
var weight int
if i == 0 {
weight = 1
} else {
weight = -1
}
files[df.Name()] += weight
}
}
for k, v := range files {
if v == 1 {
fmt.Println(k)
}
}
}