<Workspace Version="1.3.2.2480" X="9.59733480805585" Y="-193.782528758887" zoom="1.02988563947098" ScaleFactor="1" Name="Rename Files" Description="This node will use an &quot;identifier&quot; to pick out files from a supplied directory to rename files to a new name supplied. Please make sure to match list lengths of identifier and new name inputs." ID="567caf18-4e7c-48bd-bc38-63ecd3816704" Category="archilab.Revit.Printing">
  <NamespaceResolutionMap />
  <Elements>
    <PythonNodeModels.PythonNode guid="b6554c90-2e45-49a3-ae6f-6fc5b16687c6" type="PythonNodeModels.PythonNode" nickname="Python Script" x="598" y="345.000000000002" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false" inputcount="4">
      <PortInfo index="0" default="False" />
      <PortInfo index="1" default="False" />
      <PortInfo index="2" default="False" />
      <PortInfo index="3" default="False" />
      <Script># Copyright(c) 2016, Konrad Sobon
# @arch_laboratory, http://archi-lab.net

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

import os

filePath = IN[0]
identifiers = IN[1]
newNames = IN[2]
RunIt = IN[3]

files = os.listdir(filePath)

if RunIt:
	try:
		errorReport = None
		for file in files:
			currentFileName = filePath + "\\" + file
		
			for i, j in zip(identifiers, newNames):
				newFileName = filePath + "\\" + j
	
				if i in file and currentFileName != newFileName:
					os.rename(currentFileName, newFileName)
	except:
		# if error accurs anywhere in the process catch it
		import traceback
		errorReport = traceback.format_exc()
else:
	errorReport = "Set RunMe to True."

#Assign your output to the OUT variable
if errorReport == None:
	OUT = newFileName
else:
	OUT = errorReport</Script>
    </PythonNodeModels.PythonNode>
    <Dynamo.Graph.Nodes.CustomNodes.Symbol guid="60dbe9ed-b053-49b2-843f-43ca6c79d918" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="290.879842347265" y="348.830749081818" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
      <Symbol value="DirectoryPath:string=&quot;&quot;" />
    </Dynamo.Graph.Nodes.CustomNodes.Symbol>
    <Dynamo.Graph.Nodes.CustomNodes.Symbol guid="23bfee4f-eab1-4e7f-926f-9f9c22f04836" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="317.417208413863" y="415.93958528246" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
      <Symbol value="Identifiers:string=[]" />
    </Dynamo.Graph.Nodes.CustomNodes.Symbol>
    <Dynamo.Graph.Nodes.CustomNodes.Symbol guid="3101b7b3-0dbe-4358-9263-bbf06a6e6b3e" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="318.928353525575" y="474.077797060684" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
      <Symbol value="NewNames: string=[]" />
    </Dynamo.Graph.Nodes.CustomNodes.Symbol>
    <Dynamo.Graph.Nodes.CustomNodes.Symbol guid="e4ff5b99-c221-45d0-9603-a0a88758a086" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="319.318170584485" y="534.458664944512" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
      <Symbol value="RunIt:bool=false" />
    </Dynamo.Graph.Nodes.CustomNodes.Symbol>
    <Dynamo.Graph.Nodes.CustomNodes.Output guid="b80abe7f-fe34-4410-9cec-a694e585b62e" type="Dynamo.Graph.Nodes.CustomNodes.Output" nickname="Output" x="854.971974116766" y="344.227873951928" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false">
      <PortInfo index="0" default="False" />
      <Symbol value="OUT" />
    </Dynamo.Graph.Nodes.CustomNodes.Output>
  </Elements>
  <Connectors>
    <Dynamo.Graph.Connectors.ConnectorModel start="b6554c90-2e45-49a3-ae6f-6fc5b16687c6" start_index="0" end="b80abe7f-fe34-4410-9cec-a694e585b62e" end_index="0" portType="0" />
    <Dynamo.Graph.Connectors.ConnectorModel start="60dbe9ed-b053-49b2-843f-43ca6c79d918" start_index="0" end="b6554c90-2e45-49a3-ae6f-6fc5b16687c6" end_index="0" portType="0" />
    <Dynamo.Graph.Connectors.ConnectorModel start="23bfee4f-eab1-4e7f-926f-9f9c22f04836" start_index="0" end="b6554c90-2e45-49a3-ae6f-6fc5b16687c6" end_index="1" portType="0" />
    <Dynamo.Graph.Connectors.ConnectorModel start="3101b7b3-0dbe-4358-9263-bbf06a6e6b3e" start_index="0" end="b6554c90-2e45-49a3-ae6f-6fc5b16687c6" end_index="2" portType="0" />
    <Dynamo.Graph.Connectors.ConnectorModel start="e4ff5b99-c221-45d0-9603-a0a88758a086" start_index="0" end="b6554c90-2e45-49a3-ae6f-6fc5b16687c6" end_index="3" portType="0" />
  </Connectors>
  <Notes />
  <Annotations />
  <Presets />
  <Cameras>
    <Camera Name="Aperçu en arrière-plan" eyeX="-0.0440317764878273" eyeY="7.85266447067261" eyeZ="48.3073883056641" lookX="-0.78298819065094" lookY="24.7802467346191" lookZ="-55.3382911682129" upX="0.00841537769883871" upY="0.80385684967041" upZ="0.594763278961182" />
  </Cameras>
</Workspace>