Pardon my persistence, but I'm curious about what the decision was for
the --move-files option. I just finished an exchange with the openssh
folks where I tried to get scp to have both a move-files option and an
option to use a temp file to put the file whole & finished into its
destination. While they may add the -u (unlink) option to scp, they
won't add any temp-file-writing options.
So, was the addition of a --move-files option to rsync rejected? Or is
this something you might consider? Attached is a new version of the
patch for the latest CVS source. Thanks for your consideration.
..wayne..
Index: options.c
--- options.c 7 May 2001 06:59:37 -0000 1.52
+++ options.c 20 May 2001 23:20:06 -0000
@@ -73,6 +73,7 @@
int modify_window=0;
#endif
int blocking_io=0;
+int move_files=0;
char *backup_suffix = BACKUP_SUFFIX;
char *tmpdir = NULL;
@@ -180,6 +181,7 @@
rprintf(F," --delete-after delete after transferring, not before\n");
rprintf(F," --ignore-errors delete even if there are IO errors\n");
rprintf(F," --max-delete=NUM don't delete more than NUM files\n");
+ rprintf(F," --move-files Files successfully transferred are removed
+from the sending side\n");
rprintf(F," --partial keep partially transferred files\n");
rprintf(F," --force force deletion of directories even if not
empty\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group
name\n");
@@ -222,7 +224,7 @@
OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY, OPT_ADDRESS,
OPT_DELETE_AFTER, OPT_EXISTING, OPT_MAX_DELETE, OPT_BACKUP_DIR,
OPT_IGNORE_ERRORS, OPT_BWLIMIT, OPT_BLOCKING_IO,
- OPT_MODIFY_WINDOW};
+ OPT_MODIFY_WINDOW, OPT_MOVE_FILES};
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
@@ -290,6 +292,7 @@
{"address", 0, POPT_ARG_STRING, 0, OPT_ADDRESS},
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir},
{"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links},
+ {"move-files", 0, POPT_ARG_NONE, &move_files},
{0,0,0,0}
};
@@ -653,6 +656,8 @@
args[ac++] = compare_dest;
}
+ if (move_files)
+ args[ac++] = "--move-files";
*argc = ac;
}
Index: rsync.yo
--- rsync.yo 23 Mar 2001 15:12:52 -0000 1.76
+++ rsync.yo 20 May 2001 23:20:08 -0000
@@ -250,6 +250,7 @@
--delete-after delete after transferring, not before
--ignore-errors delete even if there are IO errors
--max-delete=NUM don't delete more than NUM files
+ --move-files Files successfully transferred are removed from the
+sending side
--partial keep partially transferred files
--force force deletion of directories even if not empty
--numeric-ids don't map uid/gid values by user/group name
@@ -469,6 +470,11 @@
transferring files to try to ensure that there is sufficient space on
the receiving filesystem. If you want to delete after transferring
then use the --delete-after switch.
+
+dit(bf(--move-files)) This tells rsync to remove the source files on
+the sending side that are successfully transferred to the receiving
+side. Directories are not removed, nor are files that are identical
+on both systems.
dit(bf(--force)) This options tells rsync to delete directories even if
they are not empty. This applies to both the --delete option and to
Index: sender.c
--- sender.c 19 Aug 2000 15:25:05 -0000 1.10
+++ sender.c 20 May 2001 23:20:09 -0000
@@ -26,6 +26,7 @@
extern int io_error;
extern int dry_run;
extern int am_server;
+extern int move_files;
/*
@@ -212,6 +213,8 @@
if (verbose > 2)
rprintf(FINFO,"sender finished %s\n",fname);
+ if (move_files && do_unlink(fname) == 0 && verbose > 1)
+ rprintf(FINFO,"sender removed %s\n",fname);
}
if (verbose > 2)