# Pastebin YD9D54eG ben_dir = 'D:\computer copy' x = scandir(ben_dir) folders = [folder for folder in x if folder.is_dir()] print(folders)