简体   繁体   中英

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/mac use "/" or ":" to define path hierarchy, so if mac filenames contain a "/", then rsync replaces the "/" with a ":" to stay safe.

however, sharing/networking this backup back to mac causes troubles this way.

Is there a way I can tell rsync to take another character, ie "_"?

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.

Thanks!

It isn't rsync doing the translation; it's done by the kernel and filesystem APIs (see this previous question and the linked USENIX paper ). The tricky character appears as a slash in MacOS-heritage APIs, and as a colon in unix-heritage APIs; rsync uses unix-heritage APIs, so it sees a colon.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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