Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File Properties

6 views
Skip to first unread message

Dwight

unread,
Mar 31, 2004, 1:59:33 PM3/31/04
to
Is there a way to get the properties of a file using
code. I need to compare the created dates of 2 files to
determine which one is older, then replace the first file
if it is older then the second file.


Thanks in advance!

Dwight

Dirk Goldgar

unread,
Mar 31, 2004, 2:31:02 PM3/31/04
to
"Dwight" <anon...@discussions.microsoft.com> wrote in message
news:13a3201c41752$4df140b0$a601...@phx.gbl

I believe the function's name is FileDateTime. Look for it in the
online help in the VB Editor.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Dwight

unread,
Mar 31, 2004, 3:18:25 PM3/31/04
to
The FileDateTime function returns the modified date. I
need to have compare the Date Created. Does anyone know
how to get the Date Created?
>.
>

Douglas J. Steele

unread,
Mar 31, 2004, 4:09:46 PM3/31/04
to
You can use the GetFileTime API (plus some others). Randy Birch has sample
code at http://vbnet.mvps.org/code/fileapi/filedatetime.htm which should
port into Access without any problem.

Another alternative is to use FSO (FileSystemObject) from the scripting
library (scrrun.dll)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)


"Dwight" <anon...@discussions.microsoft.com> wrote in message

news:1687e01c4175d$523b4570$a401...@phx.gbl...

Dirk Goldgar

unread,
Mar 31, 2004, 4:25:00 PM3/31/04
to
"Dwight" <anon...@discussions.microsoft.com> wrote in message
news:1687e01c4175d$523b4570$a401...@phx.gbl

> The FileDateTime function returns the modified date. I
> need to have compare the Date Created. Does anyone know
> how to get the Date Created?

Ah, I understand now. Apparently Doug Steele does. :-)

M.L. Sco Scofield

unread,
Apr 1, 2004, 12:21:33 AM4/1/04
to
The FSO works great. You can get created, modified, and accessed date/time.

That's what I use at the bottom of my web site pages like http://www.scobiz.com/Calendar.asp and
http://www.scobiz.com/Presentations.asp.

You need to set a reference to "Microsoft Scripting Runtime" in VBA or use late binding.

For time's sake, I just copied the VBScript from my ASP. (It uses late binding.) You shouldn't have any problem cleaning it up for
VBA.

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(Server.MapPath("Presentations.asp"))
datDateCreatedASP = objFile.DateCreated
datDateLastModifiedASP = objFile.DateLastModified
datDateLastAccessedASP = objFile.DateLastAccessed

Good luck.

--

Sco

M.L. "Sco" Scofield, MCSD, MCP, MSS, Access MVP, A+
Useful Metric Conversion #16 of 19: 2 monograms = 1 diagram
Miscellaneous Access and VB "stuff" at www.ScoBiz.com

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message news:%23$LVCS2FE...@TK2MSFTNGP10.phx.gbl...

0 new messages