diff --git a/.gitignore b/.gitignore
index 66fd13c..688e157 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.dll
*.so
*.dylib
+FileCompare
# Test binary, built with `go test -c`
*.test
diff --git a/.idea/FileCompare.iml b/.idea/FileCompare.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/FileCompare.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..dbeac43
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/main.go b/main.go
index d378a2e..daa019b 100644
--- a/main.go
+++ b/main.go
@@ -139,6 +139,7 @@ func main() {
}
func saveSummary(path string) {
+ fileExists, err := os.Stat(path)
summaryFile, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
fmt.Println(err)
@@ -146,11 +147,15 @@ func saveSummary(path string) {
}
defer summaryFile.Close()
+ if fileExists == nil {
+ summaryFile.WriteString(fmt.Sprintf("\"%s\",\"%s\",\"%s\",\"%s\"\n", "hash", "filepath", "bytes", "copies"))
+ }
+
for hash, files := range ds.Files {
if len(files) > 1 {
// _, err := summaryFile.WriteString(fmt.Sprintf("%s - %s Duplicates", hash, len(files)))
for _, file := range files {
- summaryFile.WriteString(fmt.Sprintf("\"%s\",\"%s\"\n", hash, filepath.Join(file.Filepath, file.Filename)))
+ summaryFile.WriteString(fmt.Sprintf("\"%s\",\"%s\",\"%d\",\"%d\"\n", hash, filepath.Join(file.Filepath, file.Filename), file.Filesize, len(files)))
}
}
}