Link to home
Start Free TrialLog in
Avatar of beregoth
beregoth

asked on

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.
Avatar of benjaFL
benjaFL

<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.
Avatar of beregoth

ASKER

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)?
ASKER CERTIFIED SOLUTION
Avatar of Nathan Stanford Sr
Nathan Stanford Sr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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