Automatic game collection shell script
-
When I download a rompack I always get a whole lot of duplicates so I created a command line script to move all of them into folders to reduce the amount of games to scroll through. It can also be used to auto collect any type of file, as long as the duplicates have their equal parts at the beginning:
https://gist.github.com/INVITR0/3c36077102def8aa0d839d29149941cb
Usage: autocollection [OPTION]... [DIRECTORY]
Option -c | --create-dirs must be set to actually collect files, if not set collections are only displayed, not created
Options:
- -V, --version display version and exit
- -h, --help display this help page and exit
- -f, --format FORMAT set file ending of files to autocollect (e.g. '.nes')
- -c, --create-dirs actually create directories
- -s, --silent don't display collections
- -v, --verbose display all files put into collections
- --prefix PREFIX prefix all collections with given value
- --postfix POSTFIX append all collections with given value
- --min-name-length INT minimum name length of collection
- --min-coll-size INT minimum collection size to be created
- -r, --revert move all games out of their collections back into the folder
- -e, --exclude exclude specific collection names (e.g. 'super,space') to prevent too large collections, comma seperated
- -i, --case-insensitive collect file names without caring about case (e.g. 'Game' and 'game')
- -a, --sort-alphabet Create alphabetical collections
-e | --exclude is useful if you have files with the same beginning which do not belong together (like "super", every second game begins with "super"). It's best to first run autocollection without the -c | --create-dirs option and make sure the --min-name-length option is set correctly.
Example:
THIS TOOL MAKES CHANGES TO YOUR FILESYSTEM. MAKE SURE TO BACK UP! It's a good idea to test in a safe directory first
Does anybody know if folders are supported in gamelists? It'd be nice to have metadata attached to the game collections.
-
Can you provide more usecases?
What should I do if I haveGame 1 (J)
Game 1 (U)
Game 2 (JUE)
Game 3 (J)
Game 3 (E)and what is the filter result?
-
That depends on your settings. Out of the box you would get one folder named "Game" with all the files in it. If you specified --min-name-length 5 you'd get:
/
-- Game 1/
------ Game 1 (J)
------ Game 1(U)
-- Game 2 (JUE)
-- Game 3/
------ Game 2 (J)
------ Game3 (E)The same would happen if you specified -e game
-
Okay got that ;)
So you may also get alphabetical subfolder?A-Game.NES
B-Game.NES
C-Game.NES
...
Z-Game.NES -
@cyperghost You mean being able to create alphabetical subfolders? Or if it does it as an unwanted side effect? As long as the letters are not seperated by anything like "-", " ", "(" or ")" it shouldn't create a folder for it. Creating alphabetic subfolders shouldn't bee too hard, if you think that'd be useful I just implemented that
-
@arambecker No my approach would be a bit more.
A tool to find duplicates.
As I said in my first post. If you have selections of several regions.Maybe 1000 roms it would be usefull to search for a gametitle and to select duplicates.
Game 1 (J) Game 1 (U) Game 2 (JUE) Game 3 (J) Game 3 (E)
You already programmed delimiter so there needs "just" to generate an automatic search term.
That's not the way your script is intended to work and I think it will need a heavy rework. But this would be usecase, tooROM Names > Automatic generated search term Game 1 (J) > Game 1 ( Game 1 (U) > Game 1 ( Game 2 (JUE) > Game 2 ( Game 3 (J) > Game 3 ( Game 3 (E) > Game 3 (
Maybe @meleu can say more to this?
Welcome on board :)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.