Hi All,
Im trying to rename files with multiple directory but i have no luck. Is it possible? I dont have idea about python but maybe this can be modify? Thank you.
@Konrad_K_Sobon
Copyright© 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 = sheets
else:
OUT = errorReport