summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/rechin25
1 files changed, 25 insertions, 0 deletions
diff --git a/.local/bin/rechin b/.local/bin/rechin
index a629413..0d3811d 100755
--- a/.local/bin/rechin
+++ b/.local/bin/rechin
@@ -0,0 +1,25 @@
+#!/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))"