Trailing slash in destination

jw schultz jw at pegasys.ws
Fri Apr 25 04:44:35 EST 2003


On Thu, Apr 24, 2003 at 09:28:50AM -0700, Wayne Davison wrote:
> 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:

Good.  Trailing slash should require a directory.  Creating
it is good form.

I often use a trailing slash on cp destinations so it will
complain if the directory doesn't exist.  Good typo catcher.

> 
> --- 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..
> -- 
> To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
> 

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt


More information about the rsync mailing list