Shin is working on a project to do something like this. I'm not sure how far along he is on it, but you could look into that.
https://github.com/xackery/eqcleanup
Also, you should really search the forums for this stuff. Most of this has been answered 4 or 5 times already over the years
