Last active
December 4, 2021 02:01
-
-
Save mettamatt/c3eade40db081f10df611223dcc326e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the ROM folder | |
BASE="/home/pi/RetroPie/roms" | |
# List the platforms to scan | |
PLATFORMS=(arcade snes nes megadrive) | |
EXTS=(.zip .sfc .7z .md) | |
MAKE_DIFFS=1 | |
DELETE=0 | |
for ((i=0;i<${#PLATFORMS[@]};++i)); do | |
if [ $MAKE_DIFFS = 1 ]; then | |
find $BASE/${PLATFORMS[i]} -type f -name "*${EXTS[i]}" -exec basename {} ${EXTS[i]} \; | sort > roms-${PLATFORMS[i]}.txt | |
find $BASE/${PLATFORMS[i]}/media/videos -type f -name "*.mp4" -exec basename {} .mp4 \; | sort > video-${PLATFORMS[i]}.txt | |
find $BASE/${PLATFORMS[i]}/media/marquees -type f -name "*.png" -exec basename {} .png \; | sort > marquee-${PLATFORMS[i]}.txt | |
find $BASE/${PLATFORMS[i]}/media/screenshots -type f -name "*.png" -exec basename {} .png \; | sort > screenshot-${PLATFORMS[i]}.txt | |
comm -13 roms-${PLATFORMS[i]}.txt video-${PLATFORMS[i]}.txt > video-${PLATFORMS[i]}.diff | |
comm -13 roms-${PLATFORMS[i]}.txt marquee-${PLATFORMS[i]}.txt > marquee-${PLATFORMS[i]}.diff | |
comm -13 roms-${PLATFORMS[i]}.txt screenshot-${PLATFORMS[i]}.txt > screenshot-${PLATFORMS[i]}.diff | |
fi | |
if [ $DELETE = 1 ]; then | |
while read p; do | |
rm "$BASE/${PLATFORMS[i]}/media/videos/$p.mp4" | |
done <video-${PLATFORMS[i]}.diff | |
while read p; do | |
rm "$BASE/${PLATFORMS[i]}/media/marquees/$p.png" | |
done <marquee-${PLATFORMS[i]}.diff | |
while read p; do | |
rm "$BASE/${PLATFORMS[i]}/media/screenshots/$p.png" | |
done <screenshot-${PLATFORMS[i]}.diff | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment