Created
April 14, 2015 14:45
-
-
Save thefotes/ea7d3ab93686c1af34c7 to your computer and use it in GitHub Desktop.
Counts number of files in each subdirectory of the current directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
for d in */; do | |
count=$(find $d -type f | wc -l) | |
if [[ $count -eq 1 ]]; then | |
result="$d $count" | |
echo $result >> results.txt | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment