Last active
March 7, 2026 22:37
-
-
Save thingsiplay/6310b22ea2c7ed74b13fd9f8bfb3dd64 to your computer and use it in GitHub Desktop.
Count ROMs
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
| #!/usr/bin/env bash | |
| # Count ROMs | |
| # Simple script to list ROM files by stripping parts of filename starting with | |
| # one of the following characters '_', '(' or '['. Then count remaining | |
| # duplicates and list them with a counter for each name. This is intended to | |
| # count my Romhacks played on emulators, but may work well for any collection. | |
| # | |
| # First argument can be a directory. Defaults to current directory. Files are | |
| # NOT searched recursively. | |
| # | |
| # Usage: count-roms dir | |
| listing="$(find "${1:-.}" -maxdepth 1 -type f -printf '%f\n' | | |
| sed -E \ | |
| -e 's/_.*//' \ | |
| -e 's/ \(.*//' \ | |
| -e 's/ \[.*//')" | |
| printf '%s' "${listing}" | sort | uniq -c | |
| printf '%s' "${listing}" | sort -u | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment