Post #3198: ac

šŸ“‹ Metadata

šŸ·ļø Tags

macro hotkeys advanced

  • Macro Editor
  • Python Scripting
  • Command tab

šŸ’¬ Content

actimelvanille:

i’d like to incrementally save the current file by increasing the number at the end of the file name by 1.

so save01.blend will be saved as an additional save02.blend in the same folder

Try this script (Command tab):

import re; fp = C.blend_data.filepath; fp = re.sub(r"(.*[^\d])(\d*)(\.blend)$", lambda mo: "%s%02d%s" % (mo.group(1), int(mo.group(2)) + 1 if mo.group(2) else 1, mo.group(3)), fp) if fp else ""; bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=fp) if fp else bpy.ops.wm.save_mainfile('INVOKE_DEFAULT')

ā¤ļø 5 likes


šŸ”— View on Blender Artists