Sharing Python Scripts to Daily Notes Index and Full Vault Index Files

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: 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

Screenshot: Daily Notes Index

daily-notes-index

Usage

  1. Download the script.
  2. Edit the script constants, as shown below
  3. Install Python3 if needed
  4. Run the script like python create-notes-index.py or python3 create-notes-index.py
  5. Use cron, Automator.app, or some other program to automate its output.

Editing Constants

  1. Find DAILY_NOTES_DIR and set it to the path of your daily notes.
  2. Find NOTES_DIR and set it to your vaults root directory.
  3. Find INDEX_NAME and set it the name of the index.
  4. Find DATE_FORMAT_REGEX and change it, unless your Daily Notes use the format YYYY-MM-DD.
  5. Find PRINT_WARNING and set it to false, unless you have a file named Warning.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

Screenshot: Full Notes Index

Usage

  1. Download the script.
  2. Edit the script constants, as shown below
  3. Install Python3 if needed
  4. Run the script like python create-notes-index-full.py or python3 create-notes-index-full.py
  5. 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 named Random/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!