Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need TCL file CREATION time

Status
Not open for further replies.

PGTurner

Programmer
Mar 2, 2003
34
US
Any way in TCL to get file creation time - as opposed to accessed time or modified time?

Familiar with mtime & atime - but apparently no "ctime".

Don't need to change it just need to retrieve it.

DIR /TC filename.ext is valid in DOS and I am playing with parsing out of an exec call but that seems hinky.

Is there a better way?
 
ctime is actually a change time - makes it useless for you. That is unless Windows implementation has changed the meaning of the ctime from *nix platforms - and this makes me a moron ;-).
Note that I'm not at all familiar with TCL - just a common filesystem knowledge.

Jean Spector
QA Team Leader @ Kashya Ltd.
 
Thanks for the reply -

I should have specified WINDOWS world

I added the "ctime" as a possible TCL option switch name - in TCL atime=Last access, mtime=Last modified. But nothing for when the file was created, which is what I am looking for.

In Windows - current - 2000/2003 server or 2000/XP
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
ie "dir /TC Filename provides the create time.

What I have done is shell out - run the dir command then parse the output but that is fairly slow and I was hoping someone might have a better - more TCLish way.


proc FileCreateTime {FileName} {
set tc \x02FTC
set DirList [split [exec cmd.exe /c dir $tc $FileName] \n]
set FileCrTime [clock scan [string range [lindex $DirList 5] 0 20]]
return $FileCrTime
}


 
I don't think you can get it in Tcl.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top