Created
May 9, 2012 17:04
-
-
Save dtinth/2646751 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
each_dir() { | |
COMMAND="$1" | |
for I in */* | |
do | |
if [ -d "$I" ]; | |
then | |
"$COMMAND" "$I" | |
fi | |
done | |
} | |
COUNT=0 | |
CURRENT=0 | |
count() { | |
COUNT=$(($COUNT+1)) | |
} | |
process() { | |
DIR="$1" | |
CURRENT=$(($CURRENT+1)) | |
echo "[$CURRENT/$COUNT] $DIR" | |
# process this dir | |
} | |
echo "Counting directories to process..." | |
each_dir count | |
echo "Done. $COUNT directories to process..." | |
each_dir process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment