# Rename Exported Notion Files With This Simple Python Script

# 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](https://cdn.hashnode.com/res/hashnode/image/upload/v1665777001096/CWHg27A2N.png align="left")

# 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)

notion-export-file-renamer.py

```
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__":
	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:

```
root/
├─ Export-95fc3bc8-a529-4c39-b414-16d278c7d197/
├─ notion-export-file-renamer.py
```

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:
```
python3 notion-export-file-renamer.py
```

Success! Your output should look like this:


![Notion Export - Renamed Output.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665777354505/zOPEFkYAh.png align="left")

Enjoy!
