diff --git a/webize b/webize index c69c577..5d39b5d 100755 --- a/webize +++ b/webize @@ -74,23 +74,23 @@ fi # Get directories with images IMAGES_REGEX='\.gif|\.jpg|\.png|\.svg|\.webp' -dirs=$( +DIRS=$( find "$DIR" -type d | while read -r d; do if ls -p "$d" | grep -v '/' | grep -E "$IMAGES_REGEX" > /dev/null; then echo "$d" fi done | sort -n ) -if [ -z "$dirs" ]; then +if [ -z "$DIRS" ]; then echo "No directories with images found." 1>&2 exit 1 fi # Generate index.htm in each directory if [ -n "$GALLERY" ]; then - echo "$dirs" | while read -r d; do - indexHtm="$d/index.htm" - imagesCsv=$( + echo "$DIRS" | while read -r d; do + INDEX_HTM="$d/index.htm" + IMAGES_CSV=$( # Get only files, ignore the first line of ls -al, then parse file attributes into a single CSV. E.g. -rwxr-xr-x 1 packer packer 22681 2021-08-27T07:36:45+0000 webize -> webize,22681,2021-08-27T07:36:45+0000 if echo "${OSTYPE:-}" | grep -qE 'darwin'; then cd "$d" @@ -107,7 +107,7 @@ if [ -n "$GALLERY" ]; then echo "$filename,$size,$dateiso,$extension" done ) - cat - > "$indexHtm" <<'EOF' + cat - > "$INDEX_HTM" <<'EOF'
@@ -143,16 +143,16 @@ if [ -n "$GALLERY" ]; then