我想获取回收站的路径。我在网上搜索并发现人们使用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);
}
感谢您的提前帮助!