WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

File Operations

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get Last Accessed/Created/Modified File Date and Time

Keywords:    fileymdhms  accessed time access date  creation date modify date

Question:

Does anyone know who to check for a file access date? The FileYMDHMS function returns the modified date, but I need something that compares the accessed date to determine if the file has been accessed in the last six months.

Answer:

FileTimeGetEx gets extended time information for a file or directory.
created = FileTimeGetEx("C:\windows\win.ini",1)
modified = FileTimeGetEx("C:\windows\win.ini",2)
accessed = FileTimeGetEx("C:\windows\win.ini",3)

Message("WIN.INI - File Times", strcat("Created: ",created,@CRLF,"Modified: ",modified,@CRLF,"Accessed: ",accessed,@CRLF))


Article ID:   W13237
Filename:   Get Date when File was Last Accessed Created Modified.txt
File Created: 2001:01:03:11:38:02
Last Updated: 2001:01:03:11:38:02