Finding a files date and time

In ASP I would make a connection to an external DLL that Microsoft supplies now called the FileSystemObject that I would then use the glean a files date and time stamp.  I also know that I can use this same DLL with CF.  However, I would like a pure CF solution if one is available.  I looked briefly at CFFILE but I am not sure that I will be able to use this to gathter the information I seek.  Suggestions on how I can use a pure CF solution to find the file date of a given file.

Actually what I am trying to accomplish is put a "Last Update: <file date>" for the page that is currently being viewed so that I can always tell, and so the surfer can as well, when that file was last put a finer point on it.

Thanks for any help you all can provide.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

nathansConnect With a Mentor Commented:
    SORT="size ASC, name DESC, datelastmodified" filter="test.bat">

The Filter can filter to find one file.


PS... here is another thing you might want.
<CFIF FileExists("#path##filename#.doc")>
File does Exist!
    SORT="size ASC, name DESC, datelastmodified">

<CFOUTPUT QUERY="mydirectory">
    Name: <BR>
    Size: #mydirectory.size# <BR>
    Type: #mydirectory.type# <BR>
    Date last modified: #mydirectory.datelastmodified# <BR>
    Attributes: #mydirectory.attributes#<BR>
    Mode: #mydirectory.mode#<BR>

Returning the datelastmodified should do what you want.
beregothAuthor Commented: question though...this technique you are using...the CFDIRECTORY command...I am assuming that this is basically a type of query, which is why you are using the CFOUTPUT QUERY tag to get all the files from the CFDIRECTORY result set....

I need only one file from the current directory...can I specify a WHERE clause or is there  FILENAME attribute so that I can clue in to one file, which will always be in the current files directory ("." I am assuming instead of specifying a directory)?
beregothAuthor Commented:
1000 pardons to benjaFL, and perhaps it was my fault to not being as precise as I should have been, but your answer was copied directly from the manual and did not actually accomplish what I was trying to do.  It led me in the right direction, but Nathan's answer was right on the money...I did eventually figure out that the filter is what I needed to use and got it working fine...but this was the answer I was looking for...besides, 50 points is not worth trying to split.

I'll give benjaFL the benefit of the doubt next time.

Thanks nathans
All Courses

From novice to tech pro — start learning today.