I wanted to be able to "move" files from server to server via rsync,
so I've added a simple "--move-files" (-m) option to my copy of the
source. The end result of this change is that any files that are
actually copied from the sender to the receiver get removed by the
sender (the code does not currently remove files that are found to be
identical, but I might change that).
Is there any general interest in a "move" option? If so, I'd be glad
to work on a patch for the CVS version (which has changed a lot in the
option parsing from the 2.4.6 version I'm currently using). One thing
I haven't verified is if it is safe for a server to support the -m
option or not (since I don't know enough about how the server setup
works).
For the curious, the "meat" of my patch is a simple change in the
send_files() function in sender.c:
Index: sender.c
@@ -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)
Comments?
..wayne..