This patch adds an option --tr=BAD/GOOD to transliterate filenames. It can be used to remove characters illegal on the destination filesystem. Jeff Weber expressed interest in this: http://lists.samba.org/archive/rsync/2007-October/018996.html To use this patch, run these commands for a successful build: patch -p1 = 30)) args[ac++] = "--no-implied-dirs"; + if (tr_opt) { + if (asprintf(&arg, "--tr=%s", tr_opt) < 0) + goto oom; + args[ac++] = arg; + } + if (write_devices && am_sender) args[ac++] = "--write-devices"; diff --git a/rsync.1.md b/rsync.1.md --- a/rsync.1.md +++ b/rsync.1.md @@ -466,6 +466,7 @@ detailed description below for a complete description. --read-batch=FILE read a batched update from FILE --protocol=NUM force an older protocol version to be used --iconv=CONVERT_SPEC request charset conversion of filenames +--tr=BAD/GOOD transliterate filenames --checksum-seed=NUM set block/file checksum seed (advanced) --ipv4, -4 prefer IPv4 --ipv6, -6 prefer IPv6 @@ -3319,6 +3320,25 @@ your home directory (remove the '=' for that). free to specify just the local charset for a daemon transfer (e.g. `--iconv=utf8`). +0. `--tr=BAD/GOOD` + + Transliterates filenames on the receiver, after the iconv conversion (if + any). This can be used to remove characters illegal on the destination + filesystem. If you use this option, consider saving a "find . -ls" listing + of the source in the destination to help you determine the original + filenames in case of need. + + The argument consists of a string of characters to remove, optionally + followed by a slash and a string of corresponding characters with which to + replace them. The second string may be shorter, in which case any leftover + characters in the first string are simply deleted. For example, + `--tr=':\/!'` replaces colons with exclamation marks and deletes + backslashes. Slashes cannot be transliterated because it would cause + havoc. + + If the receiver is invoked over a remote shell, use `--protect-args` to + stop the shell from interpreting any nasty characters in the argument. + 0. `--ipv4`, `-4` or `--ipv6`, `-6` Tells rsync to prefer IPv4/IPv6 when creating sockets or running ssh. This diff -Nurp a/rsync.1 b/rsync.1 --- a/rsync.1 +++ b/rsync.1 @@ -542,6 +542,7 @@ detailed description below for a complet --read-batch=FILE read a batched update from FILE --protocol=NUM force an older protocol version to be used --iconv=CONVERT_SPEC request charset conversion of filenames +--tr=BAD/GOOD transliterate filenames --checksum-seed=NUM set block/file checksum seed (advanced) --ipv4, -4 prefer IPv4 --ipv6, -6 prefer IPv6 @@ -3372,6 +3373,23 @@ daemon uses the charset specified in its regardless of the remote charset you actually pass. Thus, you may feel free to specify just the local charset for a daemon transfer (e.g. \fB\-\-iconv=utf8\fP). +.IP "\fB\-\-tr=BAD/GOOD\fP" +Transliterates filenames on the receiver, after the iconv conversion (if +any). This can be used to remove characters illegal on the destination +filesystem. If you use this option, consider saving a "find . \-ls" listing +of the source in the destination to help you determine the original +filenames in case of need. +.IP +The argument consists of a string of characters to remove, optionally +followed by a slash and a string of corresponding characters with which to +replace them. The second string may be shorter, in which case any leftover +characters in the first string are simply deleted. For example, +\fB\-\-tr=':\\/!'\fP replaces colons with exclamation marks and deletes +backslashes. Slashes cannot be transliterated because it would cause +havoc. +.IP +If the receiver is invoked over a remote shell, use \fB\-\-protect-args\fP to +stop the shell from interpreting any nasty characters in the argument. .IP "\fB\-\-ipv4\fP, \fB\-4\fP or \fB\-\-ipv6\fP, \fB\-6\fP" Tells rsync to prefer IPv4/IPv6 when creating sockets or running ssh. This affects sockets that rsync has direct control over, such as the outgoing diff -Nurp a/rsync.1.html b/rsync.1.html --- a/rsync.1.html +++ b/rsync.1.html @@ -457,6 +457,7 @@ detailed description below for a complet --read-batch=FILE read a batched update from FILE --protocol=NUM force an older protocol version to be used --iconv=CONVERT_SPEC request charset conversion of filenames +--tr=BAD/GOOD transliterate filenames --checksum-seed=NUM set block/file checksum seed (advanced) --ipv4, -4 prefer IPv4 --ipv6, -6 prefer IPv6 @@ -3129,6 +3130,23 @@ free to specify just the local charset f --iconv=utf8).

+
--tr=BAD/GOOD
+

Transliterates filenames on the receiver, after the iconv conversion (if +any). This can be used to remove characters illegal on the destination +filesystem. If you use this option, consider saving a "find . -⁠ls" listing +of the source in the destination to help you determine the original +filenames in case of need.

+

The argument consists of a string of characters to remove, optionally +followed by a slash and a string of corresponding characters with which to +replace them. The second string may be shorter, in which case any leftover +characters in the first string are simply deleted. For example, +--tr=':\/!' replaces colons with exclamation marks and deletes +backslashes. Slashes cannot be transliterated because it would cause +havoc.

+

If the receiver is invoked over a remote shell, use --protect-args to +stop the shell from interpreting any nasty characters in the argument.

+
+
--ipv4, -4 or --ipv6, -6

Tells rsync to prefer IPv4/IPv6 when creating sockets or running ssh. This affects sockets that rsync has direct control over, such as the outgoing