FROM#/. NET: extract content / file attributes from a file inside the recycle bin

I just want to ask if it is possible to automatically get the contents of the dump file from the recycle bin. The content I'm looking for is file attributes such as Last Modified Date, Created Data, Size, etc. (Without restoring the file itself to its original location to preserve the original attributes inside the trash).

+4
source share
2 answers

There is no direct C # solution. Calling P / Invoke is one way.

The location of the recycle bin and other special folders often used by applications may be limited by CSIDL (Shell) . For the basket, the CSIDL_BITBUCKET enumeration is used. CSIDL is used in conjunction with one of the four Shell functions, SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation and SHGetSpecialFolderPath to get a special folder path.

The C ++ implementation can be found here: How to programmatically use the cart.

Some examples of C #.

Size and number of files in the recycle bin.
Empty trash

0
source

Source: https://habr.com/ru/post/1307220/


All Articles