开发者

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

开发者 https://www.devze.com 2022-12-27 18:35 出处:网络
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 Mod

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

精彩评论

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

关注公众号