with --backup-dir.
rsync changes since last release
+ ENHANCEMENTS:
+
+ * The --delete-after option now implies --delete. (Wayne Davison)
+
+ * The --suffix option can now be used with --backup-dir. (Michael
+ Zimmerman)
+
BUG FIXES:
* Fix "forward name lookup failed" errors on AIX 4.3.3. (John
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=62489
- * The --delete-after option now implies --delete.
-
INTERNAL:
* Many code cleanups and improved internal documentation. (Martin
#include "rsync.h"
extern int verbose;
+extern int suffix_specified;
extern char *backup_suffix;
extern char *backup_dir;
if (!file) return 1;
/* make a complete pathname for backup file */
- if (strlen(backup_dir) + strlen(fname) > (MAXPATHLEN - 1)) {
+ if (strlen(backup_dir) + strlen(fname) +
+ (suffix_specified ? strlen(backup_suffix) : 0) > (MAXPATHLEN - 1)) {
rprintf (FERROR, "keep_backup filename too long\n");
return 0;
}
- snprintf(keep_name, sizeof (keep_name), "%s/%s", backup_dir, fname);
+ if (suffix_specified) {
+ snprintf(keep_name, sizeof (keep_name), "%s/%s%s", backup_dir, fname, backup_suffix);
+ } else {
+ snprintf(keep_name, sizeof (keep_name), "%s/%s", backup_dir, fname);
+ }
#ifdef HAVE_MKNOD
int write_batch = 0;
int read_batch = 0;
+int suffix_specified = 0;
char *backup_suffix = BACKUP_SUFFIX;
char *tmpdir = NULL;
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
{"version", 0, POPT_ARG_NONE, 0, OPT_VERSION, 0, 0},
- {"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
+ {"suffix", 0, POPT_ARG_STRING, &backup_suffix, OPT_SUFFIX, 0, 0 },
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
{"password-file", 0, POPT_ARG_STRING, &password_file, 0, 0, 0 },
{"ignore-times", 'I', POPT_ARG_NONE, &ignore_times , 0, 0, 0 },
print_rsync_version(FINFO);
exit_cleanup(0);
+ case OPT_SUFFIX:
+ /* The value has already been set by popt, but
+ * we need to remember that a suffix was specified
+ * in case a backup-directory is used. */
+ suffix_specified = 1;
+ break;
+
case OPT_MODIFY_WINDOW:
/* The value has already been set by popt, but
* we need to remember that we're using a
-R, --relative use relative path names
-b, --backup make backups (default ~ suffix)
--backup-dir make backups into this directory
- --suffix=SUFFIX override backup suffix
+ --suffix=SUFFIX define backup suffix
-u, --update update only (don't overwrite newer files)
-l, --links copy symlinks as symlinks
-L, --copy-links copy the referent of symlinks
dit(bf(--backup-dir=DIR)) In combination with the --backup option, this
tells rsync to store all backups in the specified directory. This is
-very useful for incremental backups.
+very useful for incremental backups. You can additionally
+specify a backup suffix using the --suffix option
+(otherwise the files backed up in the specified directory
+will keep their original filenames).
dit(bf(--suffix=SUFFIX)) This option allows you to override the default
backup suffix used with the -b option. The default is a ~.
+If --backup-dir and --suffix are both specified,
+the SUFFIX is appended to the filename even in the backup directory.
dit(bf(-u, --update)) This forces rsync to skip any files for which the
destination file already exists and has a date later than the source