Last updated on April 8th, 2023 at 10:15 pm
#!/bin/bash
# This script converts all JPG files in the current directory to PNG files
cd /path/jpg
for file in *.jpg *.JPG *.jpeg; do
# Check if the file exists
if [ -e "$file" ]; then
# Replace the file extension with .png
new_file="${file%.jpg}"
new_file="${new_file%.JPG}.png"
# Convert the JPG file to a PNG file
convert "$file" "$new_file"
# Print the conversion status
echo "Converted $file to $new_file"
fi
done