import os def listdirs(base): for line in os.listdir(base): fullpath = os.path.join(base,line) if os.path.isdir(fullpath): listdirs(fullpath) elif os.path.isfile(fullpath): print fullpath base = r'C:\Program Files\SogouInput\Components' listdirs(base)