Hi all,
I am new to this and apologise if this is in the wrong place.
I'm working on a little project and I need to scan through the recent folder on a windows machine and retrieve the timestamps (I can do all that..) my problem starts when I try to read the timestamps of the link file.
I was wondering if any one new of a way to retrieve the timestamp from the link file.
I am using Visual Studio 2008.
Any help would be great
Thanks
VulpesPosted Mar 23, 2011, 11:49 AM
The results were:
So, it would seem for Google Chrome at least, both the .NET and API functions are giving the same result and that they are giving the actual creation time for the .lnk file, and not its target which was created 32 seconds earlier.
VulpesPosted Mar 23, 2011, 1:47 PM
Ian PalmerPosted Mar 23, 2011, 1:28 PM
Thank you for the time you have taken, I was wrong i have tested it again and it is working
many thanks
VulpesPosted Mar 23, 2011, 10:47 AM
I couldn't see anything in the MSDN docs about this and, if you look at the relevant properties using Reflector, then the API function GetFileAttributesEx is called in the background.
According to the documentation for this function (http://msdn.microsoft.com/en-us/library/aa364946(VS.85).aspx):
"If the path points to a symbolic link, the function returns attributes for the symbolic link."
If you're sure that this isn't the case, then you could try P/Invoking this function direct (http://pinvoke.net/default.aspx/kernel32/GetFileAttributesEx.html) but, other than that, I don't know what else to suggest.
Ian PalmerPosted Mar 23, 2011, 9:29 AM
I am trying to retrieve the timestamps of the link file itself, when i use the FileInfo it returns the timestamps for the target file.
I am trying to get the Created, Modified and Access times of the link file.
thanks for the reply, and any more help would be appreciated
Thanks
Micke BlomqvistPosted Mar 23, 2011, 7:47 AM
Could you be a bit more precise, wich of the FileInfo properties do you have problems with?
FileInfo fi = new FileInfo("file.lnk");
The fi object now exposes these properties:
fi.CreationTime
fi.CreationTimeUtc
fi.LastAccessTime
fi.LastAccessTimeUtc
fi.LastWriteTime
fi.LastWriteTimeUtc