Rename files in a folder?

python

#1

hi dynapips,

im trying to rename existing file using dynamo, but i cant get it to work. Any ideas?

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

import os

files = IN[0]
newNames = IN[1]

nfiles = []

for i, n in zip(files,newNames):
	newfile = os.rename(i, n)
	nfiles.append(newfile)

OUT = nfiles

#2

You have to feed it an entire path name, not just a file name. Right now you are just sending in two bits of text and it has no idea what to do with it.