Another feature proposal and implementation plan: --strip-prefix

Jim Salter jim at jrssystems.net
Wed Apr 14 23:42:44 GMT 2004


Wouldn't it be easier just to create a softlink on the cygwin machine so 
that you could access C: from /c ?

Or for that matter, if these are easily-confused Windows users, just 
begin the Samba (or other SMB) share south of the cygwin/ on the rsync 
machine?

> Here's another feature I'd like to have:
> 
> Suppose you're copying a source file /a/b/c/d/e/f/g/h/myfile and you 
> want it stored on some other filesystem /backup, but you want the source 
> path to be truncated so that the file actually ends up as: 
> /backup/h/myfile.
> 
> This comes up (in particular) when doing backups of windows machines via 
> cygwin; you end up with a phony base directory /cygdrive/. When users go 
> to see their backups, they become confused! This option would eliminate 
> this problem.
> 
> I'd like to add this behavior, similar to the patch -p option.
> 
> I'm uncertain whether the syntax should be 
> --strip-prefix=/a/b/c/d/e/f/g, or --strip-prefix=7. The former would 
> allow us to detect situations in which we were being asked to copy files 
> that did not have the expected prefix and to complain loudly (or 
> silently ignore the strip prefix directive for that file?) The latter 
> would be more like patch -p, but I think it's less safe. Perhaps 
> multiple --strip-prefix directives should be allowed so that a single 
> invocation of rsync can handle more complicated situations.
> 
> I think this can be relatively cleanly implemented in recv_files; in 
> fact, the line "fnamecmp=fname;" in reciever.c seems to be exactly the 
> hook required. Like my previous email, I would like to ask for advice 
> and suggestions so that my implementation will be most useful!
> 
> Thanks,
> 
> -Ed
> 



More information about the rsync mailing list