Matthew Smilansky
Matthew's Blog

Matthew's Blog

Rename Exported Notion Files With This Simple Python Script

Photo by Hitesh Choudhary on Unsplash

Rename Exported Notion Files With This Simple Python Script

Get rid of those ugly, auto-generated file and folder names with this simple script.

Matthew Smilansky's photo
Matthew Smilansky
·Oct 14, 2022·

1 min read

The Problem

When you export files from Notion, the name of each exported file and folder is appended with an ugly GUID (yuck!):

Notion Export - Raw Output.png

The Solution:

Place the folder containing your newly exported Notion files into a folder that contains this file: (you'll need to create this file and copy/paste the code below into it)

import os
import re 

file_regexp = r'( \w{32,32}\b)'

def main():
    for root, dirs, files in os.walk(os.getcwd(), topdown=False):
            for f in files:
                f_path = os.path.join(root, f)
                subtitute_f_path = re.sub(file_regexp, '', os.path.abspath(f_path))
                os.renames(f_path, subtitute_f_path)

if __name__ == "__main__":

For reference, please note that the folder containing your exported Notion files will be named something like this:

  • Export-95fc3bc8-a529-4c39-b414-16d278c7d197

Your working directory folder structure should now look like this:

├─ Export-95fc3bc8-a529-4c39-b414-16d278c7d197/

Now, Run the Python script from the root dir - again, this script should be placed in the same folder as the folder containing your exported Notion files:


Success! Your output should look like this:

Notion Export - Renamed Output.png


Share this