Last active
February 8, 2023 21:39
-
-
Save cfbastarz/58d73a39e75239c1bed88b49dcf7934c to your computer and use it in GitHub Desktop.
Compara dois diretórios e a quantidade de arquivos nas subpastas
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
#! /bin/bash | |
# Considerando que os diretórios estão organizados da seguinte forma: | |
# 2020010100 | |
# 2020010200 | |
# 2020010300 | |
# etc | |
# | |
# Linguagem: Bash | |
# @cfbastarz | |
for data in $(cat datas_ok.txt) | |
do | |
ano=$(echo $data | cut -c 1-4) | |
nshare=$(ls /share/${ano}/${data} | wc -l) | |
ndados=$(ls /dados/${data} | wc -l) | |
if [ ${nshare} -eq ${ndados} ]; then flag="ok"; else flag="verificar"; fi; | |
[ "$(ls -A /share/${ano}/${data})" ] && echo "/share/${ano}/${data} ${flag} (share: ${nshare}; dados ${ndados})" || echo "/share/${ano}/${data} vazio" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment