Hi,
How to find out the date of the last file change ?
Hi,
How to find out the date of the last file change ?
cFILE := "C:\INST_NFE\MyProgam.exe"
aDIR := DIRECTORY( cFILE )
dEXE := aDIR[1] [3]
dDateVersion := DTOC( dEXE )Thanks.
And how do I find out the date when the file was created and the date when the file was last opened ?
If I understand correctly ... Create a database and save all the information on system usage in this database. Sorry if that's not it.
Regards.
  local oFs, oFile, cFile
  oFs  := CreateObject( "Scripting.FileSystemObject" )
  cFile := "c:\fwh\samples\maria01.prg"
  if oFs:FileExists( cFile )
   oFile := oFs:GetFile( cFile )
   ? oFile:DateCreated, oFile:DateLastModified, oFile:DateLastAccessed
  else
   ? cFile + " does not exist"
  endifThanks, Mr.Rao. This is what you need !
#include "Fivewin.ch"
FUNCTION MAIN()
    LOCAL  dDate
   Â
    dDate := FCREATEDATE( "C:\TEST.PDF" )
       Â
    MsgStop( dDate )
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( FCREATEDATE )
{
    HANDLE      hFile  ;
    WIN32_FIND_DATA wfd ;
    SYSTEMTIME    st ;
    hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
    if ( hFile != INVALID_HANDLE_VALUE )  {
        FileTimeToSystemTime( &wfd.ftCreationTime, &st ) ;
   Â
        FindClose( hFile ) ;
    } Â
    else  {
        st.wYear = 0 ;
        st.wMonth = 0 ;
        st.wDay = 0 ;
    }
   Â
    hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
#pragma ENDDUMPPlease,
the definition of oFile:DateLastAccessed?
How can I try this?
How do I open a file to find that modified parameter?
Many thanks
Marco
#include "Fivewin.ch"
FUNCTION MAIN()
    LOCAL  dDate
   Â
    dDate := FCREATEDATE( "C:\TEST.PDF" )    Â
       Â
    MsgStop( dDate )
   Â
    dDate := FLACCESSDATE( "C:\TEST.PDF" )    Â
       Â
    MsgStop( dDate )
   Â
    dDate := FLWRITEDATE( "C:\TEST.PDF" )    Â
       Â
    MsgStop( dDate )
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( FCREATEDATE )
{
    HANDLE      hFile  ;
    WIN32_FIND_DATA wfd ;
    SYSTEMTIME    st ;
    hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
    if ( hFile != INVALID_HANDLE_VALUE )  {
        FileTimeToSystemTime( &wfd.ftCreationTime, &st ) ;
   Â
        FindClose( hFile ) ;
    } Â
    else  {
        st.wYear = 0 ;
        st.wMonth = 0 ;
        st.wDay = 0 ;
    }
   Â
    hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
HB_FUNC( FLACCESSDATE )
{
    HANDLE      hFile  ;
    WIN32_FIND_DATA wfd ;
    SYSTEMTIME    st ;
    hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
    if ( hFile != INVALID_HANDLE_VALUE )  {
        FileTimeToSystemTime( &wfd.ftLastAccessTime, &st ) ;
   Â
        FindClose( hFile ) ;
    } Â
    else  {
        st.wYear = 0 ;
        st.wMonth = 0 ;
        st.wDay = 0 ;
    }
   Â
    hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
HB_FUNC( FLWRITEDATE )
{
    HANDLE      hFile  ;
    WIN32_FIND_DATA wfd ;
    SYSTEMTIME    st ;
    hFile = FindFirstFile( hb_parc( 1 ), &wfd ) ;
    if ( hFile != INVALID_HANDLE_VALUE )  {
        FileTimeToSystemTime( &wfd.ftLastWriteTime, &st ) ;
   Â
        FindClose( hFile ) ;
    } Â
    else  {
        st.wYear = 0 ;
        st.wMonth = 0 ;
        st.wDay = 0 ;
    }
   Â
    hb_retd( st.wYear, st.wMonth, st.wDay ) ;
}
#pragma ENDDUMP