Answer the question
In order to leave comments, you need to log in
How to loop through all directories starting from /home/.. and find *.txt files and show them with cat, including their directories?
Good afternoon, how to write a script that will go through all the folders and if in this folder, for example , folder1 , there is a text file, then display it on the screen via cat ?
Probably no one understood what I really need. Let's say there are such directories
/home/folder1/folder2/folder3
in folder2 there is a text file file.txt.
/home/folder1/folder2/file.txt
We need an example of a script that will iterate through all directories starting from /home/......
and find these *.txt files and at the END output
folder2 - file.txt - (what written inside file.txt) i.e.
Folder
Name - Text File Name - (what is written inside the text file)
The problem is that a folder or file can have any name. and I won't be able to use their names like in this script.echo "folder2 - file.txt - $(cat file.txt)"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question