简体   繁体   English

rsync从Mac到Linux:冒号替换

[英]rsync get from mac to linux: colon replacement

I'm backing up on a linux to rsync data from a remote apple mac to save locally. 我正在Linux上备份,以便从远程Apple Mac同步数据以保存在本地。

linux/mac use "/" or ":" to define path hierarchy, so if mac filenames contain a "/", then rsync replaces the "/" with a ":" to stay safe. linux / mac使用“ /”或“:”来定义路径层次结构,因此,如果mac文件名包含“ /”,则rsync将“ /”替换为“:”以保持安全。

however, sharing/networking this backup back to mac causes troubles this way. 但是,将此备份共享/联网回到Mac会导致这种麻烦。

Is there a way I can tell rsync to take another character, ie "_"? 有什么办法可以让rsync接受另一个字符,即“ _”?

I could rename my files using 我可以使用

find /path/to/basedir/* -iname "*:*"  | tac |  sed 's/\(.*\):\(.*\)$/mv "&" "\1_\2"/' | sh

but this breaks the rsync incremental magic. 但这打破了rsync增量魔术。

Thanks! 谢谢!

It isn't rsync doing the translation; 不是由rsync进行翻译; it's done by the kernel and filesystem APIs (see this previous question and the linked USENIX paper ). 它是由内核和文件系统API完成的(请参阅前面的问题链接的USENIX论文 )。 The tricky character appears as a slash in MacOS-heritage APIs, and as a colon in unix-heritage APIs; 棘手的字符在MacOS继承API中显示为斜线,在Unix继承API中显示为冒号。 rsync uses unix-heritage APIs, so it sees a colon. rsync使用unix-heritage API,因此会出现冒号。

The best solution isn't to try to translate the character differently, it's to figure out what's going wrong with the sharing/networking you're using, and figure out why it isn't doing the appropriate translation. 最好的解决方案不是尝试对字符进行不同的翻译,而是要找出正在使用的共享/网络出了什么问题,并找出为什么它没有进行适当的翻译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM