# Python code to create index automatically

**URL:** <https://forum.johnnydecimal.com/t/python-code-to-create-index-automatically/645>\
**Category:** Workbook/Workshop\
**Created:** [January 15, 2023, 10:43am UTC](https://forum.johnnydecimal.com/t/python-code-to-create-index-automatically/645 "2023-01-15T10:43:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel.d](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/joel.d/32/277_2.png) [@joel.d](https://forum.johnnydecimal.com/u/joel.d)\
**Post date:** [January 15, 2023, 10:43am UTC](https://forum.johnnydecimal.com/t/python-code-to-create-index-automatically/645/1 "2023-01-15T10:43:45Z")

</div>

**TL;DR: I have made a python code that will index your JD hierarchy for you.**

You can see/download the code here: [GitHub - drillvoice/psychic-succotash: Python code to index 3 levels of folder hierarchy · GitHub](https://github.com/drillvoice/psychic-succotash). To run it you will need Python.

I have begun learning Python and today I had an experiment at using ChatGPT to develop Python code. One thing I want to do was index my folders that use Johny Decimal. After a few rounds of iteration I’ve got something I’m happy with. It will index 3 level of JD Folders (and there should be only 3 levels!) and output an index.txt file in the top-level folder. You need to copy the path for top-level folder and paste it when prompted. This was mostly ChatGPT doing the work with me tweaking it to get what I wanted.
