mirror of
https://github.com/JaCoB1123/dupe-finder.git
synced 2025-05-18 06:01:56 +02:00
Reenable commented logic
This commit is contained in:
parent
f8564f20ac
commit
587f904ebc
28
main.go
28
main.go
@ -1,12 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"slices"
|
||||
@ -45,11 +51,11 @@ func main() {
|
||||
var countFiles int64 = 0
|
||||
filesMap := newFilesMap()
|
||||
if *fromFile != "" {
|
||||
// byteValue, _ := ioutil.ReadFile(*fromFile)
|
||||
// err := json.Unmarshal(byteValue, &filesMap.FilesByHash)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
byteValue, _ := ioutil.ReadFile(*fromFile)
|
||||
err := json.Unmarshal(byteValue, &filesMap.FilesByHash)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
filesMap.incomingBar = filesMap.progress.AddSpinner(0,
|
||||
mpb.PrependDecorators(
|
||||
@ -103,12 +109,12 @@ func main() {
|
||||
}
|
||||
|
||||
if *toFile != "" && *fromFile == "" {
|
||||
// json, _ := json.MarshalIndent(filesMap.FilesByHash, "", " ")
|
||||
// ioutil.WriteFile(*toFile, json, 0644)
|
||||
json, _ := json.MarshalIndent(filesMap.FilesByHash, "", " ")
|
||||
ioutil.WriteFile(*toFile, json, 0644)
|
||||
}
|
||||
|
||||
if *deleteDupesIn != "" {
|
||||
/* deleteIn := filepath.Clean(*deleteDupesIn)
|
||||
deleteIn := filepath.Clean(*deleteDupesIn)
|
||||
for hash := range filesMap.FilesByHash {
|
||||
duplicateFiles := filesMap.FilesByHash[hash]
|
||||
if len(duplicateFiles) <= 1 {
|
||||
@ -146,9 +152,9 @@ func main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} else if *promptForDelete {
|
||||
/* reader := bufio.NewReader(os.Stdin)
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
for hash := range filesMap.FilesByHash {
|
||||
duplicateFiles := filesMap.FilesByHash[hash]
|
||||
if len(duplicateFiles) <= 1 {
|
||||
@ -183,7 +189,7 @@ func main() {
|
||||
remove(file)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
countInstances := 0
|
||||
countDupeSets := 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user