Thursday, January 14, 2010

Find the file location, root folder, last modified, Last Data Accessed

Dim fso, fsoobj
filespec = "c:\testfile.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoobj = fso.GetFile(filespec)
'File Location for testing
fPath = fsoobj.Path
'File Created Date
fPath = fPath & "File Created:" & fsoobj.DateCreated
'File Last Accessed
fPath = fPath & "Data Last Accessed:" & fsoobj.DateLastAccessed
'File Last Modified
fPath = fPath & "Data Last Modified:" & fsoobj.DateLastModified
MsgBox fPath
'Display the Drive Name & Location
Set fsodri = fso.getdrive(fso.getdrivename(filespec))
MsgBox fsodri

No comments: