views:

149

answers:

2

Hi,

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 recycle bin.)

Comments and suggestions are highly appreciated. Thanks.

+2  A: 

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.

Petar Minchev
@Petar: good article. do you think the 'Date Modified' is also included?
eibhrum
I haven't tried it, but I think it should be included.
Petar Minchev
A: 

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

Aseem Gautam