Created
June 24, 2016 12:52
-
-
Save brunodasilvalenga/5f249ecf382657a7b07b6bd9677ecfdb 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
#!/bin/bash | |
atual=`date +'%Y/%m/%d'` | |
ano=`date +'%Y'` | |
mes=`date +'%m'` | |
dia=`date +'%d'` | |
file_date=`date +'%Y_%m_%d'` | |
dir_nfe="/dados/nfe/" | |
touch /tmp/0.txt | |
for i in `/bin/ls -1 $dir_nfe | grep dados`; do | |
if [ -d "$dir_nfe$i/$atual" ]; then | |
/bin/find $dir_nfe$i/$atual -type f -name "*.xml" -exec ls {} \; > /tmp/1.txt | |
if [ "$(diff 0.txt 1.txt)" != '' ]; then | |
diff 0.txt 1.txt | sed 's/^> //g' | sed 's/^< //g' | sed 's/^> //g' > /tmp/2.txt | |
cat /tmp/2.txt | grep '.xml' > /tmp/2.lock | |
cat /tmp/2.lock | sort | uniq -u > /tmp/2.txt | |
for i in `cat /tmp/2.txt` ; do | |
cp $i /dados/averbacoes-teste/nfe/ | |
done | |
cat /tmp/2.txt >> /tmp/0.txt | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment