Initial commit

This commit is contained in:
2025-11-26 19:57:06 -05:00
commit 76c81548bf
8 changed files with 182 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
#
# zip_images_recursive Resizing large JPGs in current directory
# Based on: https://shkspr.mobi/blog/2016/12/converting-rar-to-zip-in-linux/
#
# Usage: xxx.sh
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
cwd=${PWD##*/}
directoryTree="${cwd}"
if [ "$#" -ne 0 ]; then
directoryTree="${1} - ${directoryTree}"
fi
jpgs=$(find . -maxdepth 1 -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$")
if [ -n "$jpgs" ]; then
echo "Zipping JPGs in ${directoryTree}"
7z a -tzip -mx=0 "$directoryTree.zip" "*.jpg" -i!*.jpeg -i!*.JPG -i!*.JPEG
fi
for subd in *; do
if [ -d "${subd}" ]; then
pushd "${subd}"
~/zip_images_recursive.sh "${directoryTree}"
popd
fi
done