Dec-07-2018, 08:19 PM
Maybe there is somewhere a magic module doing the job...
Anyway, you can do it with the os module:
Anyway, you can do it with the os module:
import os,os.path for dirname in os.listdir('.'): if os.path.isdir(dirname): for filename in os.listdir(dirname): newname = filename.split('.')[0] os.rename(dirname,newname) break