I'm trying to make a simple program that reads when the Recycle Bin was last modified the relevant code with follow:
DateTime lastModifiedRB = System.IO.File.GetLastWriteTime(@"C:\$Recycle.bin");
Console.WriteLIne("Recycle Bin was last modified at: " + lastModifiedRB.ToString();
There is an issue with this however as the directory: C:\$Recycle.Bin does not directly open the Recycle Bin itself so the reading is invalid.
Is there a universal path I can follow that would allow the program to read the actual date modified of the Recycle Bin?
Any help is appreciated, thanks in advance.
Fixed via adding
var user = WindowsIdentity.GetCurrent().User;
At start of program, if fetches the SID of the user which then I added onto the end of the directory:
C:\$Recycle.Bin\ + user