-
-
Save tknerr/b9966738a139d7a05f3407f4351c8105 to your computer and use it in GitHub Desktop.
show the total count and list the first 10 files per day, archive all of them
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
# show the total count and list the first 10 files per day | |
for i in `seq 1 100`; do files=$(find . -daystart -mtime $i); num=$(echo $files | wc -w); date=$(date -d "-$i day" +%Y-%m-%d); if [ $num -gt 0 ]; then echo "$num files found for $date"; echo $files | tr ' ' '\n' | xargs ls -l | head -n 10; fi; done | |
# also archive... | |
for i in `seq 1 100`; do files=$(find /var/log/ccu/noise-test -daystart -mtime $i -name "TM-Noise*.csv.*.gz"); num=$(echo $files | wc -w); date=$(date -d "-$i day" +%Y-%m-%d); if [ $num -gt 0 ]; then echo "$num files found for $date"; echo $files | tr ' ' '\n' | xargs ls -l | head -n 10; tar -czf /tmp/TM-NoiseTest-$date.tgz $files; fi; done | |
# long | |
for i in `seq 1 100`; do | |
files=$(find /var/log/ccu/noise-test -daystart -mtime $i -name "TM-Noise*.csv.*.gz"); | |
num=$(echo $files | wc -w); | |
date=$(date -d "-$i day" +%Y-%m-%d); | |
if [ $num -gt 0 ]; then | |
echo "$num files found for $date"; | |
echo $files | tr ' ' '\n' | xargs ls -l | head -n 10; | |
tar -czf /tmp/TM-NoiseTest-$date.tgz $files; | |
fi; | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment