【发布时间】:2020-12-22 02:57:03
【问题描述】:
是否有列出快捷方式文件夹的目标目录的 python 代码?我要做的是列出目标目录中的所有文件夹及其子文件夹,显然这个主文件夹中的大多数文件夹都是快捷方式文件夹。
当我运行下面的 python 程序时,它会跳过所有快捷方式文件夹。
import os
main_folder_path = r"mainfolder"
for path, directory, files in os.walk(main_folder_path):
print(directory)
【问题讨论】:
标签: python directory subdirectory shortcut target