dots


dots / scripts / Scripts
chasinglightning  ·  2025-05-11

tinypin-log.sh

 1#!/bin/bash
 2#
 3# i use this to check on the files uploaded to my tinypin instance regularly
 4# because tinypin has no admin dashboard or whatever
 5# use the extract cmd provided at the end or else u get ugly empty folders
 6
 7basedir="/mnt/tank/tinypin-data/images"
 8WD="/home/kat/tinypin-log"
 9now=$(date "+%Y-%m-%d")
10
11cd ${WD} && mkdir -p ${WD}/${now}
12
13newdir=$(echo "${WD}/${now}")
14
15for f in *.jpg *.JPG *.jpeg *.png *.webp *.gif; do
16  cd ${basedir} && find . -type f -not -path "./1/*" -exec cp --parent -t ${newdir}/ {} +
17done
18
19cd ${WD} && tar -czf ${now}.tar.gz -C ${WD} .
20
21/bin/rm -rf ./${now}
22
23# extract:
24# tar xzf *.tar.gz --transform='s/.*\///' && find . -type d -empty -delete