Skip to content

Instantly share code, notes, and snippets.

@fnx4
Created December 4, 2021 16:11
Show Gist options
  • Save fnx4/b101838cfe6cb26f5dd67d365887d4fb to your computer and use it in GitHub Desktop.
Save fnx4/b101838cfe6cb26f5dd67d365887d4fb to your computer and use it in GitHub Desktop.
#!/bin/bash
folder="preview";
declare -a formats=("png" "jpg" "jpeg" "bmp" "webp");
#mkdir "$folder";
echo "push service: scanning $folder/ ...";
for ext in "${formats[@]}"; do
for file in *."$ext"; do
if [ -f "$file" ]; then
new_file="$folder/${file%.*}.jpg";
if ! [ -f "./$new_file" ]; then
echo "converting ./$file -> ./$new_file";
ffmpeg -i "./$file" -vf scale="300:-1" "./$new_file" -loglevel error;
fi
fi
done
done
echo "push service: scanning complete";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment