开发者

C#/.NET: Retrieving the contents/file attributes from a file inside a recycle bin

I just wanna ask if there's a possibility to retrieve the contents of a 'dump' file from the recycle bin programatically. The contents that I'm looking for are file attributes like 'Date Last Modified, 'Data created', 'size', etc (without restoring the file itself to the original location to preserve the original attributes found while inside the rec开发者_Python百科ycle bin.)


This article should help you. As the guy pointed out in his article there is surely a P/Invoke solution but he couldn't find it.


There is a not direct c# solution. P/Invoke calls is one of the way.

The location of Recycle bin and other special folders used frequently by applications can be idenitified by CSIDL(Shell). For recycle bin the enum used is CSIDL_BITBUCKET. A CSIDL is used in conjunction with one of four Shell functions, SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation, and SHGetSpecialFolderPath, to retrieve a special folder's path.

The C++ implementaion can be found here: How to programmatically use the Recycle Bin

Some c# samples.

Recycle Bin file size and file count.
Empty Recycle Bin

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜