mirror of
https://github.com/JaCoB1123/dupe-finder.git
synced 2025-05-18 06:01:56 +02:00
Handle all files of set being insider or outside the deleteDupesIn-Folder
This commit is contained in:
parent
66a9ae73e5
commit
3c3f1d747b
25
main.go
25
main.go
@ -40,6 +40,7 @@ func main() {
|
||||
if *verbose {
|
||||
printConfiguration()
|
||||
}
|
||||
|
||||
countFiles := 0
|
||||
filesMap := newFilesMap()
|
||||
if *fromFile != "" {
|
||||
@ -80,6 +81,28 @@ func main() {
|
||||
continue
|
||||
}
|
||||
|
||||
hasDupesInFolder := false
|
||||
hasDupesOutsideFolder := false
|
||||
for _, file := range duplicateFiles {
|
||||
fileIsInFolder := strings.HasPrefix(filepath.Clean(file), deleteIn)
|
||||
hasDupesOutsideFolder = hasDupesOutsideFolder || !fileIsInFolder
|
||||
hasDupesInFolder = hasDupesInFolder || fileIsInFolder
|
||||
}
|
||||
|
||||
if !hasDupesInFolder || !hasDupesOutsideFolder {
|
||||
if !hasDupesOutsideFolder {
|
||||
fmt.Println("Not deleting one of the following files, since all would be deleted")
|
||||
}
|
||||
if !hasDupesInFolder {
|
||||
fmt.Println("Not deleting one of the following files, since none are in the selected directory")
|
||||
}
|
||||
|
||||
for _, file := range duplicateFiles {
|
||||
fmt.Println("-", file)
|
||||
}
|
||||
fmt.Println()
|
||||
continue
|
||||
}
|
||||
for _, file := range duplicateFiles {
|
||||
if strings.HasPrefix(filepath.Clean(file), deleteIn) {
|
||||
fmt.Println("Would delete ", file)
|
||||
@ -124,11 +147,9 @@ func main() {
|
||||
if *force {
|
||||
remove(file)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
countInstances := 0
|
||||
countDupeSets := 0
|
||||
for hash := range filesMap.FilesByHash {
|
||||
|
Loading…
x
Reference in New Issue
Block a user