Trailing slash in destination
Wayne Davison
wayned at samba.org
Fri Apr 25 02:28:50 EST 2003
On Thu, Apr 24, 2003 at 03:20:28PM +1000, Gavin Schokman wrote:
> Is there a reason for rsync ignoring trailing slashes ?
Not that I can see. I've just checked-in this fix for the problem:
--- main.c 18 Apr 2003 20:03:41 -0000 1.166
+++ main.c 24 Apr 2003 16:24:07 -0000
@@ -285,6 +285,7 @@
static char *get_local_name(struct file_list *flist,char *name)
{
STRUCT_STAT st;
+ int e;
extern int orig_umask;
if (verbose > 2)
@@ -310,7 +311,7 @@
return name;
}
- if (flist->count <= 1)
+ if (flist->count <= 1 && ((e = strlen(name)) <= 1 || name[e-1] != '/'))
return name;
if (do_mkdir(name,0777 & ~orig_umask) != 0) {
> ${RSYNC} -avz root@${site}:/data/access_* ${LOG_REPOSITORY}/${site}/
A way to make this work with an existing rsync is to use a directory
reference and exclude/include options, like this:
${RSYNC} -avz --include='/access_*' --exclude='/*' root@${site}:/data/ ${LOG_REPOSITORY}/${site}/
This works even when there's only one access_* file to copy because the
copy also includes the '.' directory. It also works when there are no
access_* files to copy, unlike your command above.
..wayne..
More information about the rsync
mailing list