How to get last modified time of Recycle Bin

1.4k views Asked by At

I've made some basic code attempting to get and display the date modified of the users recycle bin. I have a DateTime which uses File.GetWriteTime on the recycle bin file. Then I'm just displaying that DateTime in a MessageBox. Here is my code:

DateTime bin = System.IO.File.GetWriteTime("c:\\$Recycle.bin\\Recycle Bin");
MessageBox.Show(Convert.ToString(bin));

It's very basic code that works on other files, however, does not seem to work with the Recycle Bin. When I execute this code, the MessageBox does not display the actual date modified of the bin, however, displays this: 12/31/1600 7:00:00 PM

After doing a little research I've figured out that this date will be displayed if LastWriteTime returns null or something along the lines of that. The file path is correct so I imagine the error is coming from retrieving the modified date. I'm not sure why this is, any help would be greatly appreciated.

0

There are 0 answers