A patch from Stefan Müller to add the --downdate option, which works
in the opposite manner as --update.
To use this patch, run these commands for a successful build:
patch -p1 <patches/downdate.diff
./configure (optional if already run)
make
based-on: d73762eea3f15f2c56bb3fa9394ad1883c25c949
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
@@ -54,6 +54,7 @@ extern int ignore_errors;
extern int remove_source_files;
extern int delay_updates;
extern int update_only;
+extern int downdate_only;
extern int human_readable;
extern int ignore_existing;
extern int ignore_non_existing;
@@ -1691,6 +1692,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
+ if (downdate_only && statret == 0 && time_diff(&sx.st, file) < 0) {
+ if (INFO_GTE(SKIP, 1))
+ rprintf(FINFO, "%s is older\n", fname);
+ return;
+ }
+
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
@@ -2115,6 +2122,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
+ downdate_only = -downdate_only;
always_checksum = -always_checksum;
size_only = -size_only;
append_mode = -append_mode;
@@ -2140,6 +2148,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
+ downdate_only = -downdate_only;
always_checksum = -always_checksum;
size_only = -size_only;
append_mode = -append_mode;
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
@@ -62,6 +62,7 @@ int preserve_uid = 0;
int preserve_gid = 0;
int preserve_times = 0;
int update_only = 0;
+int downdate_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
int do_xfers = 1;
@@ -681,6 +682,7 @@ void usage(enum logcode F)
rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n");
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update skip files that are newer on the receiver\n");
+ rprintf(F," -w, --downdate skip files that are older on the receiver\n");
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
rprintf(F," --append-verify like --append, but with old data in file checksum\n");
@@ -916,6 +918,7 @@ static struct poptOption long_options[] = {
{"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
+ {"downdate", 'w', POPT_ARG_NONE, &downdate_only, 0, 0, 0 },
{"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
{"ignore-non-existing",0,POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
{"ignore-existing", 0, POPT_ARG_NONE, &ignore_existing, 0, 0, 0 },