Rsync how to include directories but not files?

♀尐吖头ヾ 提交于 2019-12-02 23:46:50
$ rsync -a -f"+ */" -f"- *" source/ destination/

"The two -f arguments mean, respectively, "copy all directories" and then "do not copy anything else"."

Further details: http://psung.blogspot.com/2008/05/copying-directory-trees-with-rsync.html

rsync -a --include='*/' --exclude='*' source/ destination/

Basically, first include all directories, then exclude all files.

If you want to sync everything except one folder but you still want to keep the directory structure of that excluded folder, you should do the following:

$ rsync -a -f"+ /var/log/**/*/" -f"- /var/log/**/*" source/ destination/

See the exclude-list and the rsync command as an example.

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