【发布时间】:2014-04-06 01:25:07
【问题描述】:
我想知道回收站的路径。我在网上搜索,发现人们使用 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);
}
提前致谢!
【问题讨论】:
-
我试过他的代码,但它不起作用。
-
那么您的意思是,如果您查看根文件夹和子文件夹,当文件到达回收站时它会收到通知?
-
是的,我监控整个文件系统
标签: c# recycle-bin