1.

Solve : How to get all properties from a file??

Answer»

Hi,
I'm creating an APP and I need to get the last time a file was accessed... since 'dir' only gives me the creation date I need something else.
I think it's possible since it's possible from the explorer...

Thx in advance,
André CostaAfind.exe from here

will list the last access time of a file ***without*** altering it.

http://www.ussrback.com/NT/audit/AFind.exe

http://www.ussrback.com/NT/audit/index.html

Code: [Select]F:\test\afind>afind -?
AFind v1.2 - Copyright(c) 1998, NT OBJECTives, Inc.
NTFS last access time finder
Programming by JD Glaser - All Rights Reserved
Command Line Switches
[dirname] Directory to search
-f [filename] List last access time of file
-s [seconds] Files accessed less than x seconds ago
-m [minutes] Files accessed less than x minutes ago
-h [hours] Files accessed less than x hours ago
-d [days] Files accessed less than x days ago
-a [d/m/y-h:m:s] Files accessed after this date/time
-ns Exclude sub-directories
- or / Either switch statement can be used
-? Help
Additional time frame usage:
afind /s 2-4 Files accessed between 2 and 4 seconds ago
afind /m 3-7 Files between 2 and 4 minutes ago
afind /s 2-4 Files between 2 and 4 seconds ago
afind /a 14/7/1998-3:12:06-15/7/1998-2:05:30 Files between these dates
COMMAND PROMPT MUST HAVE A MINIMUM WIDTH OF 80 CHARACTERS


Code: [Select]F:\test\afind>afind /a 1/1/1980-0:00:00
Searching...
F:\test\afind
AFind.exe 29/06/2007 18:11:16
New Text Document.txt 29/06/2007 18:11:44
qparam.cmd 29/06/2007 18:11:30

Finished

without external COMMANDS, you can use vbscript
Code: [Select]Dim objFile,objFSO,FileName
FileName="c:\temp\test.bat"
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.GetFile(FileName)
WScript.Echo "File Date last modified",objFile.DateLastModified
WScript.Echo "File Date last access: ",objFile.DateLastAccessed
WScript.Echo "File Date last created: ",objFile.DateCreated
output:
Code: [Select]Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

File Date last modified 6/12/2007 11:55:51 PM
File Date last access: 6/20/2007 10:35:30 PM
File Date last created: 3/3/2007 10:30:09 AM



Discussion

No Comment Found