Last Accessed Date for a file
Hi,
I have a issue for regarding the access of file for particular date. I want to read Last Accessed date of a file.I know that there are lots of method to do that but the problem is that when i am using any of the method it returns me today's date.Now i don't understand what to do so i finally decided to post my query here so that i can get the solution of the same. Help me with the proper solution. Waiting for the solution.
Thanks in advance.
Re: Last Accessed Date for a file
Hey buddy,
I having the same query about the reading the last access file date so i think i am the right person to resolve your query. Just the file expiration dates method. All the file expiration method with the date are stored in the file access. So check the code with the file expiration mechanism and see whether it is working or not. If it work then let me know the same.
Thank you
Re: Last Accessed Date for a file
Use the Ctime() function to get the last accessed file date. It will be the better idea. This provides a way for getting on the scalar sense of the original core function localtime().
Code:
for ( @ARGV )
{
print "\tFile: $_";
print "\t accessed : ", ctime( stat($_)->atime );
print "\t modified : ", ctime( stat($_)->mtime );
print "\t created on: ", ctime( stat($_)->ctime );
}
Re: Last Accessed Date for a file
Its better to use the GetFileTime API function which will give you the file times in Universal Time Coordinates which is the same as GMT. There is one more method known as FileTimeToLocalFileTime API function which will allow you to access the times in your local file system time
Say thanks if it is working.