Eduardo
Eduardo

Reputation: 25

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

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.

Upvotes: 0

Views: 1168

Answers (1)

datenwolf
datenwolf

Reputation: 162164

Instead of shell globing use find:

find . -type f -exec stat {} \; | tee output.txt

Upvotes: 2

Related Questions