Mods directory organizer (1 Viewer)

hownoemail

Potential Patron
Joined
Dec 10, 2013
Hey
I have been lurking for a few months and I thought I'd share a tool I've written for myself for reindexing and sorting my Mods character folder. What it does when it runs is generates the CharacterFolders.txt file for your mods directory and regenerates any CharacterFolders files in deeper directories which have them (any directory with a CharacterFolders.txt file is treated as a mods directory all other are treated as mods).

direct download:
https://gist.githubusercontent.com/anonymous/11152139/raw/16e54e5fccd177a06aa45902e838dbc9a71e296a/gen_mods.py

gist source if you want to modify it:
https://gist.github.com/anonymous/11152139

You need to have python 2.7.x installed
https://www.python.org/downloads/
Put the file in the Mods directory next to CharacterFolders.txt

usage 1:
open the command prompt
go the directory:
<letter of the drive>: <enter>(example "c:")
cd <path to your mods direcory> <enter>

run the program:
python gen_mods.py <enter>

usage 2:
right click on gen_mods.py
create shortcut
right click shortcut
click properties
add "python " at the beginning (without " off course)
save
double click the shortcut

usage 3:
if you know how to run command line tools you can get more advanced options with -h
(not much now but I'll maybe add some sorting options if anybody needs them)

EDIT:
fixed typo
EDIT 2:
updated script to organize recursively by default
 

ModGuy

Content Creator
Joined
Feb 17, 2011
Error on line 92:

Code:
ios.path.join(source, f), args=args,

Should be:
Code:
os.path.join(source, f), args=args,

EDIT:
I understand that you've added in command line arguments for control, but given that the average user is expecting the script to do perform the one operation it's kinda unnecessary.
 

hownoemail

Potential Patron
Joined
Dec 10, 2013
Damn You're right got a typo between testing and release (the shame has no bounds)

Already fixed the links to ones with correct script

Eell I could probably make it so it runs by default with "organize -r" (and I did ) but since I wrote mostly for myself It's hard for Me to target the still non existent average user :D
 

ModGuy

Content Creator
Joined
Feb 17, 2011
Glad you fixed it.
I've also noticed that all folders get treated as character folders regardless of content, even if they're empty.
Mods Folder.jar checks for the existence of loadable files before adding the directory to the index.
Source here:
http://pastebin.com/raw.php?i=j5ZnY2ZP
Your script includes the $ folders which are ignored in the index, this isn't an issue though.
Finally the shallow checking could miss changes further in the directory structure, it might make sense to rebuild the entire index leaving shallow as an option.
Out of interest, why didn't you use the included jar?
 

hownoemail

Potential Patron
Joined
Dec 10, 2013
MG said:
I've also noticed that all folders get treated as character folders regardless of content, even if they're empty.
Mods Folder.jar checks for the existence of loadable files before adding the directory to the index.
Source here:
http://pastebin.com/raw.php?i=j5ZnY2ZP
Mostly by design as I create folders to be filled with content later. Never thought about putting other dirs in Mods. I'll probably add later.

MG said:
Finally the shallow checking could miss changes further in the directory structure, it might make sense to rebuild the entire index leaving shallow as an option.
That's what it does now, if You don't specify shallow it goes recursive by default.

MG said:
Out of interest, why didn't you use the included jar?
1. I think it needs java java 7 and I'm to lazy to upgrade since oracle got control (programing in python is more fun then upgrading the JVM)
2. couldn't find source to modify it to my tastes (sorting, dirs before chars etc.)
3. I Could :D
 

sby

Content Creator
Coder
Joined
Sep 11, 2012
lolz, i created something similar. it crawls through all character folders and asks you to add things it found relevant to the mods.txt file or to removes ones that it cannot find. it is totally not smart at all, but it was made before folder of folders was possible so simple worked.

but it was something i threw together to do a cleanup of my folders, never trusted my programming to hand it out to manage other people's files xD
 

Users who are viewing this thread

Top


Are you 18 or older?

This website requires you to be 18 years of age or older. Please verify your age to view the content, or click Exit to leave.