Improvements

This commit is contained in:
2025-11-27 04:22:46 +00:00
parent dba00da901
commit 97ba5eac6a
7 changed files with 141 additions and 10 deletions
+11 -4
View File
@@ -5,6 +5,11 @@
#
# Usage: xxx.sh file [file ...]
if [ $# -eq 0 ]; then
echo "Usage: $0 file.zip [file2.zip ...]"
exit 1
fi
echo "Resizing large JPGs in ZIPs"
# Use RAM disk for temporary files.
@@ -23,10 +28,12 @@ CURRENT_FILE=0
for INFILE in "$@"; do
CURRENT_FILE=$((CURRENT_FILE + 1))
# Convert to absolute path
INFILE="$(realpath "$INFILE")"
echo "Processing file $CURRENT_FILE of $TOTAL_FILES: $INFILE"
# Absolute path to old file
#OLDFILE=$(realpath "${INFILE}")
OUTFILE="${INFILE%.zip}-compress.zip"
OUTFILE="$(realpath "${INFILE%.zip}-compress.zip")"
# Remove output file if it already exists
if [ -e "${OUTFILE}" ]; then
@@ -81,7 +88,7 @@ for INFILE in "$@"; do
if [ ! -s "$OUTFILE" ]; then
echo "Error: Output file is empty or does not exist. Keeping original file."
cleanup_temp
continue
exit 1
fi
rm "$INFILE"