Post

count file size from json

1
2
3
4
5
6
7
8
9
set -o nounset                              # Treat unset variables as an error

for f in ../json/lesson_[0-9]*.json
#for f in ../json/lesson_1608905.json
do
  lesson_id=${f:15:7}
  out=`jq '..|select(objects and has("resourceType") and (.resourceType|length>0)).resourceID' $f|xargs du -chk ../activity/*|tail -n 1 |awk -F ' ' '{print ($1-501)}'`
  echo "$lesson_id ${out}K"
done
This post is licensed under CC BY 4.0 by the author.