mirror of
https://github.com/JaCoB1123/dupe-finder.git
synced 2025-05-18 22:21:55 +02:00
Handle files in specific folders
This commit is contained in:
parent
80acc7054f
commit
dbd93e8d86
13
main.go
13
main.go
@ -10,6 +10,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -48,21 +49,25 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *deleteDupesIn != "" {
|
if *deleteDupesIn != "" {
|
||||||
fmt.Println("Deleting", filesMap)
|
deleteIn := filepath.Clean(*deleteDupesIn)
|
||||||
for size := range filesMap.FilesBySize {
|
for size := range filesMap.FilesBySize {
|
||||||
fmt.Println("Deleting")
|
|
||||||
for hash := range filesMap.FilesBySize[size] {
|
for hash := range filesMap.FilesBySize[size] {
|
||||||
duplicateFiles := filesMap.FilesBySize[size][hash]
|
duplicateFiles := filesMap.FilesBySize[size][hash]
|
||||||
if len(duplicateFiles) <= 1 {
|
if len(duplicateFiles) <= 1 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Would delete")
|
fmt.Println("DupeGroup")
|
||||||
for _, file := range duplicateFiles {
|
for _, file := range duplicateFiles {
|
||||||
|
if strings.HasPrefix(filepath.Clean(file), deleteIn) {
|
||||||
|
fmt.Println("d", file)
|
||||||
|
} else {
|
||||||
|
fmt.Println("k", file)
|
||||||
|
}
|
||||||
if !*force {
|
if !*force {
|
||||||
fmt.Println(file)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user