using Shell32;
變種SHL =新殼牌();
// Get recycle folder
Folder Recycler = Shl.NameSpace(10);
FolderItems items = Recycler.Items();
for (int i = 0; i < items.Count; i++)
{
try
{
FolderItem FI = items.Item(i);
string FileName = Recycler.GetDetailsOf(FI, 0);
string FilePath = Recycler.GetDetailsOf(FI, 1);
string RecyleDate = Recycler.GetDetailsOf(FI, 2);
if (FileName == "your file/folder")
{
// check if chosen item is a folder
if (FI.IsFolder)
{
Directory.Delete(FI.Path, true);
}
else
{
File.Delete(FI.Path);
}
}
}
catch (Exception exc)
{
...
}
希望這可能會有所幫助。適用於我)
你怎麼知道這是你正在尋找的文件?內容,大小等? – 2009-07-13 16:36:08
1.相同的擴展 2.清除一切,包括隱藏文件夾回收,只刪除我的文件 瞧它在那裏的唯一文件 – eric 2009-07-13 17:45:13