Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get a file's modified date/time and size in bytes?
#5
Well, for a single file, you can use this...
(Here the code do not test if the file exist !)


Code: (Select All)
FICO$ = "d:\temp\CATALOGUE_PEARL_AVRIL_SEPT_2024.pdf"

GoSub INFOFIC
Print NAMEFIC$ + Chr$(10) + Str$(volufic#) + Chr$(10) + DATEFIC$ + Chr$(10) + TIMEFIC$
Sleep
End
'--------------------------------


'---SUB, go in with 'fico$' = full path+name of the file--informations given for one single ------
INFOFIC: Shell _Hide "cmd /c dir " + FICO$ + " /X > D0S-DATA.INF"
DATEFIC$ = "": canal = FreeFile: Open "D0S-DATA.INF" For Input As canal
While Not EOF(canal): Line Input #canal, i$:: i$ = _Trim$(i$)
    If Mid$(i$, 3, 1) = "/" And Mid$(i$, 6, 1) = "/" Then
        DATEFIC$ = Left$(i$, 10): i$ = _Trim$(Right$(i$, Len(i$) - 10))
        TIMEFIC$ = Left$(i$, 5): Mid$(TIMEFIC$, 3, 1) = "h"
        i$ = _Trim$(Right$(i$, Len(i$) - 5)):  J = InStr(i$, " "): VoluFic$ = Left$(i$, J - 1): VoluFic1$ = ""
        For u = 1 To Len(VoluFic$): V$ = Mid$(VoluFic$, u, 1): If InStr("0123456789", V$) > 0 Then VoluFic1$ = VoluFic1$ + V$
        Next u: volufic# = Val(VoluFic1$):  NAMEFIC$ = _Trim$(Right$(i$, Len(i$) - J))
    End If
    If DATEFIC$ <> "" Then GoTo finito
Wend
finito: Close canal: Kill "D0S-DATA.INF": Return
'-------------------------------------------
Why not yes ?
Reply


Messages In This Thread
RE: how to get a file's modified date/time and size in bytes? - by euklides - 05-22-2024, 02:29 PM



Users browsing this thread: 7 Guest(s)