📋 Metadata
- Author: roaoao
- Date: 2020-04-20 21:54:36
- Type:
answer - Reply to: post_03193
- Replies (1): post_03200
💬 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