Is it possible to use tree
to create several output files without being cd ~/ into the directory I want to create a tree
file?
For example, I have a directory called parent-dir
.
Inside of parent-dir
are subdirectories titled a
, b
, c
to z
and one also titled 0-9
.
Inside of those subdirectories are more subdirectories that are titled at random using lower/upper case, numbers and some special characters. (It is at this level I want to create a tree
.txt output file)
Here is the directory structure:
parent-dir ( <-- I will be cd ~/ here and run cmd from here)
|_a
| |_ahgfVFCJC6.h78 ( <-- cmd should create a tree titled ahgfVFCJC6.h78.txt)
| | |_file.jpg
| | |_file.mp4
| |
| |_a34grBVFHEwerv ( <-- cmd should create a tree titled a34grBVFHEwerv.txt)
| |_file.txt
| |_file.mp3
|
|_b
| |_bhlHKH.7tbh ( <-- cmd should create a tree titled bhlHKH.7tbh.txt)
| |_file.png
| |_file.txt
...and so on...
The .txt files created using `tree`:
ahgfVFCJC6.h78.txt
a34grBVFHEwerv.txt
bhlHKH.7tbh.txt
should be outputted in a specified directory (example: ~/Desktop/Tree)
I am hoping to run a command while in parent-dir
because in a
alone there are thousands of directories like ahgfVFCJC6.h78
(but named differently). Having to cd into each of those sub-subdirectories would take far too much time.