NOTE: To be clear, I do not want to empty the recycle bin as answered in other questions.
Using answers from other questions on both Stack Overflow and Super User I have discovered the way to get the location of one's recycle bin in C# is:
@"C:\$Recycle.Bin\" + System.Security.Principal.WindowsIdentity.GetCurrent().User.ToString()
However, when I run the following code I am getting different files to what is actually in my recycle bin:
string location = @"C:\$Recycle.Bin\" + System.Security.Principal.WindowsIdentity.GetCurrent().User.ToString();
foreach (string file in Directory.GetFiles(location))
{
Console.Writeline(file);
}
How can I correctly get all the files in my recycling bin? My needs are to access when the files were last used and to possibly then restore them.
Thanks.