Re: File Date/Time

 BBS: Inland Empire Archive
Date: 03-31-93 (06:46)             Number: 348
From: DICK DENNISON                Refer#: NONE
  To: MICHAEL BAILEY                Recvd: NO  
Subj: Re: File Date/Time             Conf: (2) Quik_Bas
MB> If you could go ahead and post GetFileDateTime, I'd appreciate it.

'Ok should be in the next 4 msgs:

______O_/_________________| SNIP |________________\_O_____
      O \                 | HERE |                / O
'This file created by PostIt! v5.0ba (VBDos version from Brent Ashley)
'>>> Start of page 1 of dt.bas

' DT      BAS : A Quick Basic tool to manipulate a file's date/time
' stamp
' author .....: Dick Dennison [74270,3636] 1:272/34 914-374-3903 *hst*
' 24 hrs
' supports ...: At least Dos 5.0 and later, untested to Dos 3.1
' syntax .....: DT [FILENAME]
' returns ....: The filename (or directory)
' includes ...: QB.bi from Microsoft
' cost .......: Free = Credit where credit due
'             : Do not use as is for commercial use - may not be resold
'             : May not be rebundled without prior written consent
' dated ......: 03/30/93 Version 1.0 released
'
'$INCLUDE: 'qb.bi'  'Supply correct path and start QB /L QB
'
DECLARE FUNCTION GetNum% (howmany%, min%, max%)
DECLARE FUNCTION getdate& ()
DECLARE FUNCTION gettime& ()
DECLARE SUB SetFileDate (filename$, datef&, timef&)
DECLARE FUNCTION filestru$ (filespec$)
DECLARE FUNCTION fixdate$ (parm%)
DECLARE FUNCTION fixtime$ (parm%)
DECLARE FUNCTION getdir$ ()

TYPE filestruct
   res AS STRING * 20
   attr AS INTEGER
   timef AS INTEGER
   datef AS INTEGER
   size AS LONG
   nameff AS STRING * 14
END TYPE
DIM SHARED fi AS filestruct

DIM SHARED mon(12) AS STRING
mon$(1) = "-Jan-": mon$(2) = "-Feb-": mon$(3) = "-Mar-": mon$(4) = _
 "-Apr-"
mon$(5) = "-May-": mon$(6) = "-Jun-": mon$(7) = "-Jul-": mon$(8) = _
 "-Aug-":
mon$(9) = "-Sep-": mon$(10) = "-Oct-": mon$(11) = "-Nov-": mon$(12) = _
 "-Dec-"

PCOPY 0, 1
COLOR 11, 0
filename$ = getdir$
CLS
PRINT filestru$(filename$)
x& = getdate&
y& = gettime&
SetFileDate filename$, x&, y&
PRINT filestru$(filename$)
PRINT "Press a key"
DO: a$ = INKEY$: LOOP WHILE a$ = ""
PCOPY 1, 0
LOCATE 25, 1

FUNCTION filestru$ (filespec$)
DIM regs AS RegTypeX
'File structures

temp$ = filespec$ + CHR$(0)

   regs.ax = &H1A00                       'DOS service to set DTA
   regs.ds = VARSEG(fi)
   regs.dx = VARPTR(fi)
   CALL INTERRUPTX(&H21, regs, regs)

   regs.ax = &H4E00                       'Find first matching file
   regs.cx = 0                            'regular files
   regs.ds = VARSEG(temp$)
   regs.dx = SADD(temp$)
   CALL INTERRUPTX(&H21, regs, regs)

   IF regs.flags AND 1 THEN
       a$ = filespec$ + " File not Found"
       filestru$ = a$

       EXIT FUNCTION
   END IF

'        PRINT fixdate$(fi.datef),
 '       PRINT fixtime$(fi.timef),
  '      PRINT fi.size,
   '     PRINT fi.nameff  'parse for AsciiZ
        datef$ = fixdate$((fi.datef))
        timef$ = fixtime$((fi.timef))
   a$ = fi.nameff + "  " + STR$(fi.size) + "  " + datef$ + timef$
   filestru$ = a$

END FUNCTION

FUNCTION fixdate$ (parm%)
'Date and time are in packed format - these are the breakouts

'>>> Continued on page 2.

--- VP [DOS] V4.09e
 * Origin: The MailMan  (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET