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
参考:
Tar only the Directory structure
© 2017, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com