Skip to content

Instantly share code, notes, and snippets.

@0x9090
Last active February 14, 2026 12:16
Show Gist options
  • Select an option

  • Save 0x9090/dea98fcec19d24b6abc93be5f684503c to your computer and use it in GitHub Desktop.

Select an option

Save 0x9090/dea98fcec19d24b6abc93be5f684503c to your computer and use it in GitHub Desktop.
ROM Clenaer
#!/usr/bin/env bash
remove_string() {
local str="$1"
local dir="."
local escaped="${str//\[/\\[}"
escaped="${escaped//\]/\\]}"
for f in "$dir"/*"$str"*; do
mv "$f" "${f/$escaped/}"
done
}
remove_t_bracket() {
local dir="."
for f in "$dir"/*"[T"*; do
local newname=$(echo "$f" | sed 's/ *\[T[^]]*\]//')
mv "$f" "$newname"
done
}
remove_sachen() {
local dir="."
for f in "$dir"/*"(Sachen"*; do
local newname=$(echo "$f" | sed 's/ *(Sachen[^)]*)//')
mv "$f" "$newname"
done
}
remove_duplicates() {
local dir="."
local tmp=$(mktemp -d)
while IFS= read -r -d '' f; do
echo "Checking: $f"
local hash=$(md5sum "$f" | cut -d ' ' -f 1)
if [ -f "$tmp/$hash" ]; then
echo "Removing duplicate: $f"
rm "$f"
else
touch "$tmp/$hash"
fi
done < <(find "$dir" -maxdepth 1 -type f -print0)
rm -rf "$tmp"
}
# remove_duplicates
remove_string " (USA)"
remove_string " (Japan)"
remove_string " (En,Fr)"
remove_string " (En,Fr,De,Es,It)"
remove_string " (En,Fr,De,Nl,Sv,No,Da)"
remove_string " (En,Fr,De,Es,It,Nl,Sv,Da)"
remove_string " (En,Fr,Es)"
remove_string " (En,Fr,De)"
remove_string " (En,Fr,De,Es,It,Nl,Sv)"
remove_string " (Europe)"
remove_string " (En,Ja,Fr,De,Es)"
remove_string " (English)"
remove_string " [!]"
remove_string " (U)"
remove_string " (W)"
remove_string " (UE)"
remove_string " (M5)"
remove_string " [S]"
remove_string " [M]"
remove_string " (E)"
remove_string "[!]"
remove_string " (V1.0)"
remove_string " (V1.1)"
remove_string " (V1.2)"
remove_string " (J)"
remove_string " (Sachen)"
remove_string " (JU)"
remove_string " (M7)"
remove_string " (Unl)"
remove_string " (M4)"
remove_string " [S]"
remove_string " [b1]"
remove_string " (M6)"
remove_string " (M2)"
remove_string " (M3)"
remove_string " [b2]"
remove_string " (M8)"
remove_string " (Rev-A)"
remove_string " (Rev-B)"
remove_string " [C]"
remove_string " (M13)"
remove_string " (M10)"
remove_string " (World)"
remove_string " (Rev 1)"
remove_string " (Rev 2)"
remove_string " (En,Ja)"
remove_string " (En,Ja,Fr,De,Es,It)"
remove_string " (En)"
remove_string " (JE)"
remove_string " [c]"
remove_string " (En,Ja,Fr,De,Es,It,Nl,Pt)"
remove_string " (USA,Europe)"
remove_string " [f1]"
remove_string " (USA, Europe)"
remove_string " (USA, Europe, Korea)"
remove_string " (Rev B)"
remove_string " (USA, Korea)"
remove_string " (En,Fr,De,Es)"
remove_string " (USA, Australia)"
remove_string " (En,Fr,De,Es,It,Sv)"
remove_string " (Japan, USA)"
remove_string " (Steam Version)"
remove_string " (Virtual Console)"
remove_string " (USA, Asia)"
remove_string " (En,Fr,De,Es,It,Nl,Pt,Sv)"
remove_string " (En,Fr,De,Es,It,Pt,Sv,No)"
remove_string " (!)"
remove_string " (US)"
remove_string "(M3)"
remove_string "(M6)"
remove_string "(M2)"
remove_string "(M5)"
remove_string "(M7)"
remove_string "(M4)"
remove_string "(M8)"
remove_string "(M9)"
remove_string "(M10)"
remove_string " (v01)"
remove_string " (v05)"
remove_string " (DSi Enhanced)"
remove_string " (PRG0)"
remove_string " (PRG1)"
remove_string " [!p]"
remove_string " (V4.0)"
remove_string " (REVA)"
remove_string " (REV0)"
remove_string " (UBI Soft)"
remove_string " (v0.10)"
remove_string " (Reprint)"
remove_string " (En,Fr,De,Sv)"
remove_string " (Rerelease)"
remove_string " (En,De,Nl)"
remove_string " (En,Fr,De,Es,It,Nl,Sv,No,Da,Fi"
remove_string " (En,Fr,De,Es,Sv)"
remove_string " (Rev 6)"
remove_string " (Rev 3)"
remove_string " (ST)"
remove_string " [h1C]"
remove_string " [h2C]"
remove_string " [h3C]"
remove_string " [hl]"
remove_string " [o1+C]"
remove_string " [o1]"
remove_string "[o1]"
remove_string " (BS)"
remove_string " [f2]"
remove_string " [hl]"
remove_string " [h1]"
remove_string " (G)"
remove_string " (F)"
remove_string " [f1+1C]"
remove_string " [f1+C]"
remove_string " [f2]"
remove_string " [f3]"
remove_string " [f4]"
remove_string " [t1]"
remove_string " (NP)"
remove_string " [f1+C]"
remove_string " [h1+C]"
remove_string " (PD)"
remove_string " [hl]"
remove_string " [b1+C]"
remove_string " [b1]"
remove_string "[b1]"
remove_string " [t2]"
remove_string " [h4C]"
remove_string " [hlR]"
remove_string " [h2]"
remove_string " [h1l]"
remove_string " [h2l]"
remove_string " (A)"
remove_string "[b1]"
remove_sachen
remove_t_bracket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment