Hopefully this post of using files8@ answers some questions
PROGRAM DIRENT_test
! SUBROUTINE FILES@(PAT, N, NMAX, FILES, ATTR, DATE, TIME, FILE_SIZE)
integer*2, parameter :: nmax = 1024
CHARACTER (LEN=128) PAT,FILES(NMAX)
INTEGER (KIND=2) N, i
INTEGER (KIND=2) ATTR(NMAX), DATE(NMAX), TIME(NMAX)
! INTEGER (KIND=3) FSIZE(NMAX)
REAL (KIND=2) FSIZE(NMAX)
integer (KIND=4) jsize
character :: cattr*6, cdate*10, ctime*8
CALL COUA@('Input directory pattern:')
READ '(A)',PAT
call FILES8@ (PAT, N, NMAX, FILES, ATTR, DATE, TIME, FSIZE)
DO i = 1,n
cattr = attr_string (attr(i))
cdate = date_string (date(i))
ctime = time_string (time(i))
jsize = fsize(i)
write (*,11) i, cattr, cdate, ctime, jsize, trim(FILES(i))
END DO
write (*,*) n, ' files located for ', trim(pat)
11 format (i4, a8, a12, a9, i13, 2x, A)
contains
character*10 function date_string (dos_date)
! https://forums.silverfrost.com/Forum/Topic/142&highlight=compressed+date
character*10 string
integer*2 dos_date
integer date_day, date_month, date_year
date_day = ibits(dos_date, 0, 5)
date_month = ibits(dos_date, 5, 4)
date_year = ibits(dos_date, 9, 7) + 1980
write ( string,fmt='(i2,'/',i2.2,'/',i4)' ) date_day, date_month, date_year
date_string = string
end function date_string
character*8 function time_string (dos_time)
character*8 string
integer*2 dos_time
integer time_second, time_minute, time_hour
time_second = ibits(dos_time, 0, 5)*2
time_minute = ibits(dos_time, 5, 6)
time_hour = ibits(dos_time, 11, 5)
write ( string,fmt='(i2,':',i2.2,':',i2.2)' ) time_hour, time_minute, time_second
time_string = string
end function time_string
character*6 function attr_string ( dos_attr )
use msw32prm
! https://forums.silverfrost.com/Forum/Topic/143&highlight=file+attributes
character*6 string
integer*2 dos_attr
string = ' '
if (iand(dos_attr, FILE_ATTRIBUTE_DIRECTORY) > 0) string = trim(string) // 'D' ! ' directory' 16
if (iand(dos_attr, FILE_ATTRIBUTE_HIDDEN) > 0) string = trim(string) // 'H' ! ' hidden' 2
if (iand(dos_attr, FILE_ATTRIBUTE_NORMAL) > 0) string = trim(string) // 'N' ! ' normal' 128
if (iand(dos_attr, FILE_ATTRIBUTE_READONLY) > 0) string = trim(string) // 'R' ! ' read only' 1
if (iand(dos_attr, FILE_ATTRIBUTE_ARCHIVE) > 0) string = trim(string) // 'A' ! ' archive' 32
if (iand(dos_attr, FILE_ATTRIBUTE_SYSTEM) > 0) string = trim(string) // 'S' ! ' system' 4
if (iand(dos_attr, FILE_ATTRIBUTE_TEMPORARY) > 0) string = trim(string) // 'T' ! ' temporary' 256
attr_string = string
end function attr_string
END PROGRAM DIRENT_test