相关疑难解决方法(0)

如何获取回收站的路径?

我想获取回收站的路径。我在网上搜索发现有人使用shell32并获取回收站中的文件列表。但是,我只想获取回收站的路径,因为我的目的是在将 IncludeSubdirectories 设置为 true 时从文件监视程序中排除监视器回收站。使用shell32获取文件列表的代码如下所示,但我不知道如何获取回收站的路径。

Shell Shl = new Shell();
Folder Recycler = Shl.NameSpace(10);
for (int i = 0; i < Recycler.Items().Count; i++)
{
    FolderItem FI = Recycler.Items().Item(i);
    string FileName = Recycler.GetDetailsOf(FI, 0);
    if (Path.GetExtension(FileName) == "") FileName += Path.GetExtension(FI.Path);
    string FilePath = Recycler.GetDetailsOf(FI, 1);
    Console.WriteLine(FilePath);
}
Run Code Online (Sandbox Code Playgroud)

提前致谢!

c# recycle-bin

5
推荐指数
1
解决办法
6万
查看次数

标签 统计

c# ×1

recycle-bin ×1