Bob Then wrote: > how can i change all files from one extension to another within a direcory?
This should work:
import os
def change_exts(suffix, new_suffix, dir_name):
for name in os.listdir(dir_name):
if name.endswith(suffix):
old_pathname = os.path.join(dir_name, name)
new_pathname = old_pathname[:-len(suffix)] + new_suffix
os.rename(old_pathname, new_pathname)
David.
--
http://mail.python.org/mailman/listinfo/python-list
