Python - Loop through files and folders


Python - Loop through files and folders

CODE
import os fileAndDirList = os.scandir() for f in fileAndDirList: if f.is_file(): print("File: " + f.name) elif f.is_dir(): print("Directory: " + f.name)

Comments