Skip to content

Instantly share code, notes, and snippets.

@mirekfranc
Created June 29, 2019 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirekfranc/7b89a3010f4e2b1a13e49c3ed81c0d27 to your computer and use it in GitHub Desktop.
Save mirekfranc/7b89a3010f4e2b1a13e49c3ed81c0d27 to your computer and use it in GitHub Desktop.
#!/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