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 {
|
if *verbose {
|
||||||
printConfiguration()
|
printConfiguration()
|
||||||
}
|
}
|
||||||
|
|
||||||
countFiles := 0
|
countFiles := 0
|
||||||
filesMap := newFilesMap()
|
filesMap := newFilesMap()
|
||||||
if *fromFile != "" {
|
if *fromFile != "" {
|
||||||
@ -80,6 +81,28 @@ func main() {
|
|||||||
continue
|
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 {
|
for _, file := range duplicateFiles {
|
||||||
if strings.HasPrefix(filepath.Clean(file), deleteIn) {
|
if strings.HasPrefix(filepath.Clean(file), deleteIn) {
|
||||||
fmt.Println("Would delete ", file)
|
fmt.Println("Would delete ", file)
|
||||||
@ -124,11 +147,9 @@ func main() {
|
|||||||
if *force {
|
if *force {
|
||||||
remove(file)
|
remove(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
countInstances := 0
|
countInstances := 0
|
||||||
countDupeSets := 0
|
countDupeSets := 0
|
||||||
for hash := range filesMap.FilesByHash {
|
for hash := range filesMap.FilesByHash {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user