I created some scripts to auto generate index files for my vault. I have them set to automatically run daily. I’m going to share two of them here.
- Script 1 is a Daily Notes Index Generator: Link to Gist
- Script 2 is a Full Vault Index Generator: Link to Gist
Script 1: Daily Notes Index Generator (Simple Output)
Scroll down for full index generator details.
Details
This one simply creates a list of of the Daily Notes files. See the screen shot. The output is simple, and it only creates the daily notes index.
Download
- It is on GitHub as a gist.
- Link: gist.github.com/create-notes-index.py
Screenshot: Daily Notes Index
Usage
- Download the script.
- Edit the script constants, as shown below
- Install Python3 if needed
- Run the script like
python create-notes-index.py
orpython3 create-notes-index.py
- Use
cron
,Automator.app
, or some other program to automate its output.
Editing Constants
- Find
DAILY_NOTES_DIR
and set it to the path of your daily notes. - Find
NOTES_DIR
and set it to your vaults root directory. - Find
INDEX_NAME
and set it the name of the index. - Find
DATE_FORMAT_REGEX
and change it, unless your Daily Notes use the formatYYYY-MM-DD
. - Find
PRINT_WARNING
and set it to false, unless you have a file namedWarning.md
.
DAILY_NOTES_DIR: str = "/Users/user/Projects/scratch/notes/Notes/DailyNotes/"
NOTES_DIR: str = "/Users/michael/Projects/scratch/notes/Notes/"
INDEX_NAME: str = "Index Daily Journal.md" # Index File Name
DATE_FORMAT_REGEX: str = r"^\d{4}-\d{2}-\d{2}" # YYYY-MM-DD
PRINT_WARNING: bool = True # Probably set to False
Expected Output
Script 2: Full Index Generator
Details
This one creates a more complete index. It creates a full index of all markdown (.md
) files.
- It creates an index of the index (I have 600+ files in my vault)
- The files are grouped by folder
- It pulls out H1 and H2 headers, and creates links to them
Download
- It is on GitHub as a gist.
- Link: gist.github.com/create-notes-index-full.py
Screenshot: Full Notes Index
Usage
- Download the script.
- Edit the script constants, as shown below
- Install Python3 if needed
- Run the script like
python create-notes-index-full.py
orpython3 create-notes-index-full.py
- Use
cron
,Automator.app
, or some other program to automate its output.
Editing Constants
- Find
VAULT_PATH
and put the path to your Obsidian vault. - Find
PRINT_WARNING
and set it to false, unless you have a file namedRandom/Warning.md
.
VAULT_PATH: str = '/Users/user/Projects/notes/Notes/' # Path to vault root.
INDEX_FILE_NAME: LiteralString = 'Index.md' # Name of index file to create
FILE_EXTENSION: LiteralString = '.md' # File extension to process
LOG_LEVEL: LiteralString = 'INFO' # Logging level: DEBUG, INFO, WARNING, ERROR
PRINT_WARNING: bool = True # Probably set to false. Outputs details from a warning file.
Expected Output
Cheers!
Hope you find these useful. Post questions here. Happy nooticing!