I'm a big SHELL fan, too. With various other switches you can output by date/time, alphabetize the order, etc. Easydos.com is a great place to look up SHELL commands like dir.
Before I used SHELL to get directory lists, I used the old QB FILES with a screen reading routine. A serious drawback is it only displays the MS-DOS8.3 names. This means 8-charater names plus a 3 character extension. So myawesomeprogram.bas gets truncated to something like: myawes~1.bas. It is also limited to what appears on the screen and if you have a lot of files, the screen scrolls and there goes you screen read when displayed option.
For fun, try...
It should give you a list of just the BASIC files in your QB64 directory.
I also remember there were some directory utilities at The QBasic Forum that used one of the QB libraries, maybe CALL ABSOLUTE, CALL INTERRUPT or maybe it was INTERRUPTX to get a directory list without using SHELL. Some of those library functions are still supported in QB64. A search for them is possible at:
https://www.tapatalk.com/groups/qbasic/memberlist.php?mode=admin_member a _DIR keyword that works like SHELL DIR would certainly be a nice addition to QB64, but instead, for some reason, we got that weird _DIR$ statement, which apparently only returns the pathway of a specified folder, like "desktop".
Ah, while I was writing this, I see you replied. Your code will work fine. Thi does the same thing, I just optimized your code a bit...
tem$
= "temp" + TIME$ + ".tmp"
SHELL _HIDE "dir /b *.fmt>" + tem$
' _HIDE gets rid of the console flashing open and closed.
REDIM di$
(1000) ' 1000 or as many records as you need. d = 0
d = d + 1
Also, if you want a faster read for a huge directory of files, use FOR BINARY instead of FOR INPUT.
Pete