我有一个文本文件,其中包含一些文件夹的目录列表,例如
./boost/1.75.0_2/.brew/boost.rb
./boost/1.75.0_2/include/boost/accumulators/accumulators.hpp
./boost/1.75.0_2/include/boost/accumulators/accumulators_fwd.hpp
./boost/1.75.0_2/include/boost/accumulators/statistics.hpp
./boost/1.75.0_2/include/boost/container/node_allocator.hpp
./boost/1.75.0_2/include/boost/container/node_handle.hpp
./boost/1.75.0_2/include/boost/container/options.hpp我想使用tree命令来获得以下目录结构的输出:
└── 1.75.0_2
├── INSTALL_RECEIPT.json
├── README.md
├── include
│ └── boost
│ ├── accumulators
│ │ ├── accumulators.hpp
│ │ ├── accumulators_fwd.hpp
│ │ ├── framework
│ │ │ ├── accumulator_base.hpp
│ │ │ ├── accumulator_concept.hpp
│ │ │ ├── accumulator_set.hpp
│ │ │ ├── accumulators
│ │ │ ├── depends_on.hpp
│ │ │ ├── external.hpp
│ │ │ ├── extractor.hpp
│ │ │ ├── features.hpp
│ │ │ └── parameters
│ │ ├── numeric
│ │ │ ├── detail
│ │ │ ├── functional
│ │ │ ├── functional.hpp我不能访问文件系统,我只有目录列表的文本文件。是否可以对该文件使用tree?
发布于 2021-04-06 18:08:13
简单来说,您可以重新创建实际的文件结构(可以在任何地方完成;在/tmp中,在VM中,甚至在远程计算机上),然后运行tree
mkdir tmptree
cd tmptree
sed 's/./\\&/g' yourFile | xargs mkdir -p
tree
cd ..
rm -r tmptreehttps://stackoverflow.com/questions/66966054
复制相似问题