Announcement

Collapse
No announcement yet.

display the files three dates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • display the files three dates

    How can I display the three dates a file has, ie....
    Creation, Modified, Access time and dates. The directory command normally
    only shows the Modified and Access dates. I need the Creation date.


    ------------------

  • #2
    I wasn't aware that a file had more than one date/time. The only
    time stamp that I am aware of is the one displayed. It shows the
    creation date or last modified, whichever is earlier (later).
    Do you know where the other two time stamp(s) are stored?
    If so, please let us know.


    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      I think the triple dates are only actually available on disks formatted
      for NTFS. Although you can get back the dates under any 32-bit version
      of Windows, the results don't necessarily make any sense under, say, a
      Win98 FAT-formatted disk. The dates may be retrieved using the Windows
      API call FindFirstFile. You can find many examples by doing a search of
      these forums.

      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        Originally posted by mark menz:
        How can I display the three dates a file has, ie....
        Creation, Modified, Access time and dates. The directory command normally
        only shows the Modified and Access dates. I need the Creation date.




        ------------------

        Comment


        • #5
          Originally posted by mark menz:
          How can I display the three dates a file has, ie....
          Creation, Modified, Access time and dates. The directory command normally
          only shows the Modified and Access dates. I need the Creation date.


          Let me clearify, under 95 and 98 and ME you have three dates, creation,
          modified and access. If you right click on a file and select properties
          it will show you all three. Creation is the date of the file creation....dah...
          Access is th elast time the file was open for any reason, modified is the last date the file was
          changed in some way or opened for write. I would like to be abe to create a file
          list with all three dates..... any ideas ? is there an addon package for the console or dos compiler
          that would allow me to get the dates ? help........


          ------------------

          Comment


          • #6
            This routine will return a file's creation date and time...
            In order to obtain the last access date (access time is always zero),
            replace "REG 1, &H5706" with "REG 1, &H5704"

            Note that the returned integers can be converted to a more readible format
            using the DOS2Date and DOS2Time routines in PowerBasic's date unit.
            (you might want to replace the line in DOS2Date that reads:
            Year = Fd + 80
            into
            Year = Fd + 1980
            Otherwise you can get dates like "01-01-100"
            Code:
            FUNCTION GetCreationDate(BYVAL FileName AS STRING, FDate AS INTEGER, FTime AS INTEGER) AS INTEGER
                DIM FHandle     AS LOCAL INTEGER
                DIM FDOSHandle  AS LOCAL INTEGER
                '
                'Replace this when using the routine inside another DIR$ loop
                IF LEN(DIR$(FileName)) = 0 THEN EXIT FUNCTION
                '
                FHandle = FREEFILE
                OPEN FileName FOR BINARY AS #FHandle
                '
                FDOSHandle = FILEATTR(FHandle, 2)
                '
                REG 1, &H5706
                REG 2, FDOSHandle
                CALL INTERRUPT &H21
                '
                'Replace the line below if you know the bit number that
                'represents the carry flag, like:
                'IF BIT(REG(0), %Carryflag) THEN GOTO GCD_Error
                '
                ! jc    GCD_Error
                '
                FTime = REG(3)
                FDate = REG(4)
                FUNCTION = -1
                '
            GCD_Error:
                CLOSE #FHandle
            END FUNCTION
            ------------------
            Sebastian Groeneveld
            mailto:[email protected][email protected]</A>

            [This message has been edited by Sebastian Groeneveld (edited February 08, 2001).]
            Sebastian Groeneveld
            mailto:[email protected][email protected]</A>

            Comment

            Working...
            X