#!/bin/sh application="gallery-dl" site="boards.4chan.org" site_domain="$(echo $site | cut -f2 -d.)" if [ ! -d "$PWD/$application" ] && [ ! -d "$PWD/$application/$site_domain" ]; then echo "Directories to read from are missing, exiting." exit 0 fi size_previous="$(du "$application" -s | awk '{print $1}')" for board in $(ls "$application/$site_domain/") do loop_count=1 total_count=$(find "$application/$site_domain/$board" -mindepth 1 -maxdepth 1 -type d | wc -l) for thread in $(ls "$application/$site_domain/$board" | cut -f1 -d" " | tac) do $application "https://$site/$board/thread/$thread" printf "Loop count: %s/%s\n" "$loop_count" "$total_count" loop_count=$(( loop_count + 1 )) done done size_after="$(du "$application" -s | awk '{print $1}')" printf "Size increase: %s\n" "$((size_after - size_previous))"