I have a folder on my HDD that contains like 1000 or so subfolders. These subfolders contain files and sometimes more subfolders.
Now what I want to have is a script that creates a .txt file for each folder on the first level. These then contain a list of file names and eventually the names of the subfolders and subfiles.
It is important to not cram it all into one file but into separate ones.
It should look like this
Name of the first folder.txt
Name of the second folder.txt
Name of the third folder.txt
Name of the fourth folder.txt
Name of the fifth folder.txt
Name of the sixth folder.txt
And Name of the first folder.txt should contain a list like this
Name of the first file.xyz
Name of the second file.zzz
Name of the third file.xyz
Name of the fourth file.zzz
Name of the fifth file.xyz
Name of Subfolder 1
Name of file.zzz
Name of another file.zzz
Name of Subfolder 2
Name of file.xyz
Name of Subsubfolder 1
Name of file.xyz
Name of file2.zzz
Best Answer
Quick solution using the
tree
command to print the directory structure.