且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

仅tar 目录结构

更新时间:2023-02-03 16:02:16

您可以使用 find 来获取目录,然后对它们进行 tar:

You can use find to get the directories and then tar them:

find .. -type d -print0 | xargs -0 tar cf dirstructure.tar --no-recursion

如果您有大约 10000 个以上的目录,请使用以下方法来解决 xargs 限制:

If you have more than about 10000 directories use the following to work around xargs limits:

find . -type d -print0 | tar cf dirstructure.tar --no-recursion --null --files-from -