find . -type d -print0 | tar cf dirstructure.tar --null --files-from - --no-recursion
参考stackoverflow的回答
You can use find to get the directories and then tar them:
find .. -type d -print0 | xargs -0 tar cf dirstructure.tar --no-recursion
If you have more than about 10000 directories use the following to work around xargs limits:
find . -type d -print0 | tar cf dirstructure.tar --null --files-from - --no-recursion
文章评论