RSYNC Directories vs Files

∥☆過路亽.° 提交于 2019-12-08 23:04:38

If you were calling rsync on the commandline, there's a switch that you would use to get the effect you're describing: the "-a" option: it's a shorthand for several other options, the most relevant one here being an instruction for rsync to recurse down from the source directory.

This would recursively copy the directory "foo" and all its contents into the directory "bar." If "bar" didn't exist, rsync would create it and then copy "foo" into it.

rsync -a foo bar

... would result in bar/foo/everything

The other teeny (but important!) detail to be aware of is whether or not you put a trailing slash on your source directory. If you instead said:

rsync -a foo/ bar

... you'd wind up with /bar/everything, but no directory called "foo" on the receiving side.

You'd be saying "copy the contents of the directory foo into the directory bar... but not the enclosing directory, foo."

Sorry this isn't more objective-C specific, but hopefully that'll get you going with rsync.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!