Rsync how to include directories but not files?

后端 未结 4 1485
半阙折子戏
半阙折子戏 2020-12-13 18:34

I have a directory structure and files like this

data/
data/a.txt
data/folder/
data/folder/b.txt
data/folder/folder/
data/folder/folder/c.txt
...
         


        
4条回答
  •  爱一瞬间的悲伤
    2020-12-13 19:31

    $ 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

提交回复
热议问题