Reputation: 16291
I have a text file with the directory listing of some folders like
./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
and I would like to use the tree command to obtain the following output with the directory structure:
└── 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
I cannot access the file system, I only have the text file with directory listing. Is it possibile to use tree
on that file?
Upvotes: 1
Views: 148
Reputation: 27215
As a quick hack, you could recreate the actual file structure (can be done anywhere; in /tmp
, in a VM, or even on a remote machine) and then run tree
:
mkdir tmptree
cd tmptree
sed 's/./\\&/g' yourFile | xargs mkdir -p
tree
cd ..
rm -r tmptree
Upvotes: 1