Home > other >  How to use the stat command for files that are in subfolders?
How to use the stat command for files that are in subfolders?

Time:01-18

I have the following code:

for file in *; do stat "$file"; done | tee output.txt

And it works great (if you don't want information from files in subfolders)

But as I need... I wanted to know if there is a way for me to modify this code so that it also gives me the information of files that are in the subfolders.

To those who can contribute in any way: thank you very much.

CodePudding user response:

Instead of shell globing use find:

find . -type f -exec stat {} \; | tee output.txt
  •  Tags:  
  • Related