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 posted...to put a finer point on it.

Thanks for any help you all can provide.
LVL 1
beregothAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

benjaFLCommented:
<CFDIRECTORY
    DIRECTORY="c:\winnt\system32"
    NAME="mydirectory"
    SORT="size ASC, name DESC, datelastmodified">

<CFOUTPUT QUERY="mydirectory">
    Name: #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>
</CFOUTPUT>

Returning the datelastmodified should do what you want.
0
beregothAuthor Commented:
Perfect...one 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)?
0
Nathan Stanford SrSenior ProgrammerCommented:
<CFDIRECTORY
    DIRECTORY="c:\"
    NAME="mydirectory"
    SORT="size ASC, name DESC, datelastmodified" filter="test.bat">


The Filter can filter to find one file.

Nathan
nathan@nsnd.com




PS... here is another thing you might want.
<CFIF FileExists("#path##filename#.doc")>
File does Exist!
</cfif>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.