--Based on Rocket_Science_Saver_Clip_Rename.eyeonscript by Brian Sinasac, reworked by Igor Kozitsyn, Dmitry Korshunov, Dmitry Slepichev and Gregory Chalenko --This edition by Gregory Chalenko assigns sequence frame padding with four digits separated by a dot: FileName.0000.ext --and creates a subfolder level higher for the new sequence --Need to add a checking if the folder name equalls the file name. --If yes, then create a new folder level higher --If not, then create in the current level. A dialog should appear to let the user conform the folder creation and choose its path. if (tool==nil) then print("It's a tool script. Please select a Saver tool before running this script") return end if tool:GetAttrs().TOOLS_RegID~="Saver" then print("It's a tool script. Please select a Saver tool before running this script") return end compName=string.gsub(comp:GetAttrs().COMPS_Name, "%.comp", "") toolName = tool:GetAttrs().TOOLS_Name fragment = string.gsub(toolName, "Saver", "") FileName = compName..fragment.."_"..os.date("%Y.%m.%d") --Extension ext="." string.gsub(tool.Clip[TIME_UNDEFINED], "%.(%w+)$", function (arg) ext=ext..arg end, 1) if (ext==".mov") then --MOV Files Padding = "" tool.Clip[TIME_UNDEFINED] = eyeon.getfilepath(tool.Clip[TIME_UNDEFINED])..FileName..Padding..ext elseif (ext==".avi") then --AVI Files Padding = "" tool.Clip[TIME_UNDEFINED] = eyeon.getfilepath(tool.Clip[TIME_UNDEFINED])..FileName..Padding..ext else --Sequences Padding = ".0000" --Parent Folder Name string.gsub(tool.Clip[TIME_UNDEFINED], "(.+\\).+\\.+", function(s) ParentFolderName = s end) --Folder Creation. Creates a subfolder level higher for the new sequence os.execute("mkdir ".."\""..ParentFolderName..FileName..ext.."\"") tool.Clip[TIME_UNDEFINED]=ParentFolderName..FileName..ext.."\\"..FileName..Padding..ext end