disable interpretation of trailing slash

Wayne Davison wayned at samba.org
Sun Jan 8 00:19:21 MST 2012

On Sat, Jan 7, 2012 at 6:40 PM, John J Foerch <jjfoerch at earthlink.net>wrote:

> This is a feature request for a command-line option to disable
> special interpretation of trailing slashes on source directories.

One solution is to install a bash script (or setup a bash function) in
place of the real rsync that strips a single trailing slash from each arg.
 That lets you specify dir// if you want to copy a dir's contents.  Here's
one I did some mild tesing on and it appears to work OK:

for arg in "${@}"; do
    # Strip a single trailing slash from each arg (if present)
    args=("${args[@]}" "${arg%/}")
echo /usr/bin/rsync "${args[@]}"
#exec /usr/bin/rsync "${args[@]}"

When you're satisfied with that, comment out the echo and uncomment the
exec.  Install it somewhere on your path ahead of the real rsync, or rename
the real rsync (tweak the script to exec the right binary) and install the
script in place of the current rsync binary.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20120107/a3978386/attachment.html>

More information about the rsync mailing list