From d19cf32e12c696b27d7509d0470b59f53d2df153 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Thu, 24 Oct 2024 13:23:41 +0200 Subject: [PATCH] Create script to generate album zip files --- scripts/create-archives.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/create-archives.sh diff --git a/scripts/create-archives.sh b/scripts/create-archives.sh new file mode 100755 index 0000000..386577a --- /dev/null +++ b/scripts/create-archives.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [ ! -d "content/albums" ] +then + echo "You are not in the correct directory. Aborting." + exit 1 +fi + +if [ -f "content/albums/_index.md" ] +then + echo "You already have an _index.md file. This looks like you are in the template." + echo "You need to run this script from the main page directory." + exit 1 +fi + +find content/albums -type d | while read dir +do + ( + echo "Creating archive for $dir" + cd "$dir" + + find -type f -iname "*.jpg" | grep -v '/thumbnail.jpg$' | zip -u album.zip -@ + ) +done