使用 tree 命令输出在不同的地方创建相同的目录树结构
use tree command output to create the same directory tree structure in different place
是否有命令或 UNIX 实用程序可以获取树输出,如:
.
`-- First
|-- data1
| `-- some_file -> /tmp/some_file
`-- data2
并在另一个地方创建相同的树结构?
来自Tar only the Directory structure
find First -type d -print0 | xargs -0 tar cf dir_template.tar --no-recursion
其中 First
是您要保存其结构的顶级目录。
复制dir_template.tar
到您的目标目的地,然后:
tar xf dir_template.tar
是否有命令或 UNIX 实用程序可以获取树输出,如:
.
`-- First
|-- data1
| `-- some_file -> /tmp/some_file
`-- data2
并在另一个地方创建相同的树结构?
来自Tar only the Directory structure
find First -type d -print0 | xargs -0 tar cf dir_template.tar --no-recursion
其中 First
是您要保存其结构的顶级目录。
复制dir_template.tar
到您的目标目的地,然后:
tar xf dir_template.tar