I have folder base_dir
with subfolders, each subfolder contain .jpg images, I want output similar to tree -L 1 base_dir
, but with number of jpg images next to subfolder name, is it possible?
Asked
Active
Viewed 171 times
1 Answers
1
This will output somwhat similar:
find base_dir -mindepth 1 -maxdepth 1 -type d -print0 |
xargs -0 -n1 sh -c 'echo "$1 $(find "$1" -name "*.jpg" | wc -l)"' --
For each directory in base_dir output the directory name and the count of files named *.jpg
. Example output:
base_dir/b 2
base_dir/a 1
base_dir/d 3
base_dir/c 0

KamilCuk
- 120,984
- 8
- 59
- 111