aboutsummaryrefslogtreecommitdiff
path: root/src/duplicate_finder.c
diff options
context:
space:
mode:
authorThorsten Töpper <atsutane@freethoughts.de>2026-02-18 21:51:53 +0100
committerThorsten Töpper <atsutane@freethoughts.de>2026-02-18 21:51:53 +0100
commitd513977a3566b14d9357906615d045d71741537f (patch)
tree3e707d2de9da71d98650fa8bb1b92ed11ab724ba /src/duplicate_finder.c
parenteed2d1323441861f2d41f0ecc0a72fcc9190fa5f (diff)
downloadduplicate_finder-d513977a3566b14d9357906615d045d71741537f.tar.gz
duplicate_finder-d513977a3566b14d9357906615d045d71741537f.tar.bz2
squash initial implementation
Diffstat (limited to 'src/duplicate_finder.c')
-rw-r--r--src/duplicate_finder.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/duplicate_finder.c b/src/duplicate_finder.c
new file mode 100644
index 0000000..bd679e9
--- /dev/null
+++ b/src/duplicate_finder.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: Apache-2.0 */
+
+/**
+ * Copyright 2026 Thorsten Töpper
+ *
+ * Keep track of files across different paths or filesystems with a sqlite db
+ * and identify duplicates. This utility should be used for housekeeping when
+ * spreading data across multiple FS / integrate old disks into newer setups.
+ *
+ * The DB stores SHA512 and SHA256 hashes calculated with the OpenSSL library,
+ * path and filenames and their corresponding stat() FS data.
+ *
+ * @file duplicate_finder.c
+ *
+ * vim:ts=4:sw=4:expandtab
+ */
+
+#include <stdlib.h>
+
+#include "trace_macros.h"
+#include "options.h"
+#include "kv_manager.h"
+#include "directory_scanner.h"
+
+
+/*=========== DEFINES, CONSTANTS AND TYPES ===========*/
+
+/*=========== GLOBAL VARIABLES ===========*/
+
+/*=========== FUNCTIONS ===========*/
+
+int main(int argc, char **argv) {
+ int path_index = 1;
+
+ if (argc > 1) {
+ path_index = parse_arguments(argc, argv);
+ }
+
+ /* TODO: as option */
+ kv_open_storage("/tmp/duplicate_finder.gdbm");
+ process_directory((path_index == argc) ? argv[path_index] : ".");
+
+ kv_dump(stdout);
+
+ kv_close_storage();
+
+ return EXIT_SUCCESS;
+}
+