Script to find unused scripts/layouts/tocs/customfunctions/etc and also to find errors in SQL

I've spent the past week doing a major database cleanup with lots of renaming. This is an organic project that's grown and changed a LOT as our client's needs changed, so there's a lot of crud. Since it's a school summer is the time to clean it up. I don't know Python, but with the help of some AI tools I was able to build a script which will examine your XML file and:

  • Find any errors in SQL statements (i.e. incorrectly called Tables or Fields)
  • Find any unused Scripts - Ignoring certain folders such as Dev Playground
  • Find any unused Layouts
  • Find any unused Custom Functions
  • Find any unused Tables or TOCs
  • Find any unused Fields

I also documented my steps for making the cleanup "safe", by making "ToDelete" folders and letting things "age" before actually deleting.

Hopefully this helps someone else. I'm not a programmer, but I think I added it to GitHub correctly. If this was a real product I'd optimize it more and move the exceptions to some sort of preferences file.

6 Likes

super cool

1 Like