Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/python3
import os
import bpy
DIRNAME = os.path.dirname(os.path.realpath(__file__))
FILES = [f for f in os.listdir(DIRNAME) if os.path.isfile(os.path.join(DIRNAME, f)) and f.endswith(('blend'))]
NEW_FILES_DIR = os.path.join(DIRNAME, 'ok')
os.mkdir(NEW_FILES_DIR)
for f in FILES:
bpy.ops.wm.open_mainfile(filepath=os.path.join(DIRNAME, f))
bpy.ops.file.make_paths_relative()
bpy.ops.wm.save_mainfile(filepath=os.path.join(NEW_FILES_DIR, f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.