Last active
February 8, 2023 21:41
-
-
Save cfbastarz/2787dd1aab1cd20f3245318b5bc63088 to your computer and use it in GitHub Desktop.
Procura arquivos com as extensões .ctl, .grb e .idx; conta os arquivos nas subpastas e mostra em vermelho quando a contagem for diferente de 60.
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 | |
# Considerando que os diretórios estão organizados da seguinte forma: | |
# 2013010100/001/*.[ctl,idx,grb] | |
# 2013010100/002/*.[ctl,idx,grb] | |
# ... | |
# 2013010100/040/*.[ctl,idx,grb] | |
# ... | |
# 2013011000/001/*.[ctl,idx,grb] | |
# ... | |
# 2013013118/040/*.[ctl,idx,grb] | |
# | |
# Linguagem: Bash | |
# @cfbastarz | |
for date in $(ls) | |
do | |
for mem in $(seq -f %03g 1 40) | |
do | |
fctctl=$(find ${date}/${mem}/*fct*ctl | wc -l) | |
fctgrb=$(find ${date}/${mem}/*fct*grb | wc -l) | |
fctidx=$(find ${date}/${mem}/*fct*idx | wc -l) | |
if [ ${fctctl} -ne 60 ] | |
then | |
fctctl=$(echo -e "\033[31m${fctctl}") | |
else | |
fctctl=$(echo -e "\033[37m${fctctl}") | |
fi | |
if [ ${fctgrb} -ne 60 ] | |
then | |
fctgrb=$(echo -e "\033[31m${fctgrb}") | |
else | |
fctgrb=$(echo -e "\033[37m${fctgrb}") | |
fi | |
if [ ${fctidx} -ne 60 ] | |
then | |
fctidx=$(echo -e "\033[31m${fctidx}") | |
else | |
fctidx=$(echo -e "\033[37m${fctidx}") | |
fi | |
echo -e "\033[37m${date} - ${mem} - ${fctctl} - ${fctgrb} - ${fctidx}" | |
done | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment