我希望 Power Query 搜索整个 C: 驱动器以查找特定扩展名的所有文件,例如 *.pdf。当我尝试在第二步中过滤文件扩展名时,出现此错误:
DataSource.NotFound: File or Folder: We couldn't find the folder 'C:\Program Files (x86)\Microsoft Office\root\vfs\Common AppData\Application Data'.
Details:
C:\Program Files (x86)\Microsoft Office\root\vfs\Common AppData
问题是,这个文件夹不存在。为什么 Power Query 返回无效的文件夹路径?PowerQuery 返回的文件夹似乎是文件夹中C:\ProgramData
文件夹的链接。
以下 M 脚本(仅限于问题区域)在第一步返回 999+ 行。如果我dir /s /ah
在命令提示符下从同一个文件夹运行,它只返回 20 个文件。
let
Source = Folder.Files("C:\Program Files (x86)\Microsoft Office\root\vfs\Common AppData"),
#"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".pdf"))
in
#"Filtered Rows"
我的最终目标是使用 Excel Power Query 在整个 C: 驱动器上查找特定扩展名的所有文件并返回它们的文件名、路径和大小。请注意,dir c:\*.pdf /b /s > list.txt
不会返回文件大小。
我安装了 Windows 10 64 位和 Office 365 32 位。