Easy to use accessor object for getting file details when using the FILES statement
The FILES statement in Liberty BASIC now has a new way of reading the list of files. Until how FILES worked by filling an array with a list of file information, and it can still be used that way. Now it has an alternate mode where the FILES statement provides a cursor over an accessor stream of file details as shown below.
'Demo of new files accessor object.
print "Files in "; StartupDir$
'Query for all files in the startup directory
files #dir, StartupDir$+"*"
'Loop while the #dir accessor still has answers left to
examine
while #dir hasAnswer()
'Advance the cursor to the next file
#dir nextFile$()
'If the next item is not a directory,
print out its details.
if #dir isdir() = 0 then
print #dir
name$(); ", "; #dir size(); ", "; #dir date$(); ", "; #dir time$()
end if
wend
end