Create script to generate album zip files
This commit is contained in:
parent
210e2a5170
commit
d19cf32e12
24
scripts/create-archives.sh
Executable file
24
scripts/create-archives.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user