LB Booster
Programming >> Liberty BASIC language >> Files command
http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1421946921

Files command
Post by Alincon on Jan 22nd, 2015, 4:15pm

I really thought there was a way to restrict the scope of the files command that allowed more than one file type. Something like this:
Code:
files path$, "*.txt;*.dat", info$()
 


Am I wrong?

r.m.
Re: Files command
Post by Richard Russell on Jan 22nd, 2015, 4:49pm

on Jan 22nd, 2015, 4:15pm, Alincon wrote:
I really thought there was a way to restrict the scope of the files command that allowed more than one file type. Am I wrong?

You are perhaps thinking of FILEDIALOG, which does indeed allow you to specify multiple extensions in the way you suggest. Unfortunately FILES doesn't.

The capabilities of the two statements are governed by the underlying Windows APIs that they call. FILEDIALOG calls the GetOpenFileName API which allows you to pass a filter like "*.txt;*.doc;*.bak" whereas the FILES statement calls the FindFirstFile API which accepts only an ambiguous filespec like "*.txt".

So, sadly, the only solution to your problem is to call FILES twice and merge the returned arrays (or get FILES to return all the files and do your own filtering afterwards).

Richard.