22 lines
517 B
Bash
22 lines
517 B
Bash
#!/bin/bash
|
|||
|
|
|
||
|
|
# Navigate to the img directory
|
||
|
|
cd img || exit
|
||
|
|
|
||
|
|
# Loop through each folder in the img directory
|
||
|
|
for folder in IMG_*; do
|
||
|
|
# Check if the folder exists and is a directory
|
||
|
|
if [ -d "$folder" ]; then
|
||
|
|
# Navigate into the folder
|
||
|
|
cd "$folder" || continue
|
||
|
|
|
||
|
|
for file in *; do
|
||
|
|
if [[ -f "$file" ]] && ! [[ "$file" =~ ^IMG_[0-9]{4}\.jpeg$ ]]; then
|
||
|
|
rm "$file"
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
|
||
|
|
# Navigate back to the img directory
|
||
|
|
cd ..
|
||
|
|
fi
|
||
|
|
done
|