Page 1 of 1

File Creation Date

Posted: Sun Oct 02, 2011 7:02 pm
by karweru
Hi everyone,

Anyone knows how to extract a file creation date? Kindly assist me.

Re: File Creation Date

Posted: Sun Oct 02, 2011 10:42 pm
by tave2009
Hello Kaweru:
This exists in Harbour and is:

? FILEDATE("C:\TEXT\TEXT.TXT") // The date

Show the date of a particular file. :lol:
Hope this helps.

Saludos
Walter

Re: File Creation Date

Posted: Mon Oct 03, 2011 11:44 am
by karweru
Thanks Walter. The function however seems to return the date the file was last changed, not created.

Re: File Creation Date

Posted: Mon Oct 03, 2011 12:07 pm
by Rathinagiri
I think we have to use Win32 API function calls for this.

http://support.microsoft.com/kb/188977

This article (for FoxPro) may help.

Re: File Creation Date

Posted: Mon Oct 03, 2011 12:15 pm
by gfilatov
karweru wrote:Thanks Walter. The function however seems to return the date the file was last changed, not created.
Have you tried the function FileStats() from harbour contrib library xHb :?:

Code: Select all

PROCEDURE ShowStats( cFile )
   LOCAL cAttrib, nSize, dCDate, nCTime, dMDate, nMTime
   LOCAL cColor

   IF FileStats( cFile, @cAttrib, @nSize, @dCDate, @nCTime, @dMDate, @nMTime )
      @10,2 SAY "File name:  " + cFile
      @11,2 SAY "Attributes: '" + cAttrib + "'"
      @12,2 SAY "File size:  " + Alltrim( Str( nSize ) )
      @13,2 SAY "Created:    " + DtoC( dCDate ) + " " + TimeOfDay( nCTime )
      @14,2 SAY "Modified:   " + DtoC( dMDate ) + " " + TimeOfDay( nMTime )
   ELSE
      cColor = SetColor( "r+/b" )
      @10,2 SAY "NOT FOUND: " + cFile
      SetColor( cColor )
   ENDIF
RETURN
Hope that helps :idea:

Re: File Creation Date

Posted: Mon Oct 03, 2011 12:26 pm
by Rathinagiri
Thanks Grigory. :)

Re: File Creation Date

Posted: Mon Oct 03, 2011 1:31 pm
by karweru
Thank you so much Grigory.

Re: File Creation Date

Posted: Mon Oct 03, 2011 1:44 pm
by danielmaximiliano
"Ohh, quien podra salvarme"

Yoooo el chapulin colorado!!!

Grigory, gracias por el dato, siempre contamos con su ayuda.


Translata Google:

"Ohh, who can be saved"

I“the chapulin colorado!!!

Grigory, thanks for the tip, always have your help.