diff --git a/DataPuller.py b/DataPuller.py index df76152..94ad097 100755 --- a/DataPuller.py +++ b/DataPuller.py @@ -30,6 +30,12 @@ parser.add_argument( action="store_true", help="List affected files without copying or deleting", ) +parser.add_argument( + "-s", + "--shallow-diff", + action="store_true", + help="Use filecmp.cmp() shallow mode for file diff (faster, but might miss changes or generate false positives)", +) args = parser.parse_args() @@ -58,7 +64,7 @@ def get_files(path): def main(): - startstring = " FOLDER-SYNC 1.0 " + startstring = " FOLDER-SYNC 0.1.3 " if not args.quiet: print( len(startstring) * "=" + "\n" + startstring + "\n" + len(startstring) * "=" @@ -90,7 +96,11 @@ def main(): for path in source: if path not in target: new.append(path) - elif not filecmp.cmp(os.path.join(inpath, path), os.path.join(outpath, path)): + elif not filecmp.cmp( + os.path.join(inpath, path), + os.path.join(outpath, path), + shallow=args.shallow_diff, + ): changed.append(path) # Check for file deletions diff --git a/pyproject.toml b/pyproject.toml index 7fc06d4..35838a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "DataPuller" -version = "0.1.2" +version = "0.1.3" description = "rsync but worse" requires-python = ">=3.13" dependencies = []