Archive Delete Mode

Robert Boucher
Sat, 13 Nov 2004 15:04:12 -0000

Patch to add an archive mode that includes deletion.

-Rob
-------------- next part --------------
Adds an archive mode that includes the delete option.

--- orig/options.c	2004-09-23 13:39:05.000000000 -0400
+++ options.c	2004-11-13 09:56:27.000000000 -0500
@@ -39,6 +39,7 @@
 int whole_file = -1;

 int archive_mode = 0;
+int archive_delete_mode = 0;
 int keep_dirlinks = 0;
 int copy_links = 0;
 int preserve_links = 0;
@@ -233,6 +234,7 @@
   rprintf(F," -q, --quiet                 decrease verbosity\n");
   rprintf(F," -c, --checksum              always checksum\n");
   rprintf(F," -a, --archive               archive mode, equivalent to
-rlptgoD\n");
+  rprintf(F," -A, --archive-delete        archive mode with delete,
equivalent to -rlptgoD --delete\n");
   rprintf(F," -r, --recursive             recurse into
directories\n");
   rprintf(F," -R, --relative              use relative path
names\n");
   rprintf(F,"     --no-relative           turn off --relative\n");
@@ -366,6 +368,7 @@
   {"verbose",         'v', POPT_ARG_NONE,   0,
'v', 0, 0 },
   {"quiet",           'q', POPT_ARG_NONE,   0,
'q', 0, 0 },
   {"archive",         'a', POPT_ARG_NONE,
&archive_mode, 0, 0, 0 },
+  {"archive-delete",  'A', POPT_ARG_NONE,
&archive_delete_mode, 0, 0, 0 },
   {"server",           0,  POPT_ARG_NONE,   &am_server, 0, 0, 0
},
   {"sender",           0,  POPT_ARG_NONE,   0,
OPT_SENDER, 0, 0 },
   {"recursive",       'r', POPT_ARG_NONE,   &recurse, 0,
0, 0 },
@@ -699,7 +702,7 @@
 		return 0;
 	}

-	if (archive_mode) {
+	if (archive_mode || archive_delete_mode) {
 		if (!files_from)
 			recurse = 1;
 #if SUPPORT_LINKS
@@ -712,6 +715,9 @@
 		preserve_devices = 1;
 	}

+	if (archive_delete_mode)
+		delete_mode = 1;
+
 	if (relative_paths < 0)
 		relative_paths = files_from? 1 : 0;