Syntax of Pattern$?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by pantera.

Do anyone know the Pattern$ syntax of the ExamineDirectory command?
The manual says:

Code: Select all

ExamineDirectory(#Directory, DirectoryName$, Pattern$) 
If I want to do a more "complex" pattern than the recomended "*.whatever" the command fails.
If I'd like to screen for both filestypes a and b an openwindow command would be like "Files|*.a;*.b" but for ExamineDirectory...?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

Hello pantera,

Maybe your problem comes from that you are trying to examine recursively.

I mean if your Pattern$ contains a matching string that exist in subdirectories from the DirectoryName$ you are starting, but no file or subdirectory contains itself this match string, you will have no result.

If this your the case, Pattern$ just have the possibility to contain a single match string. So you should make a *.* search first and then filter yourself the result you put in an array.

Let me know if you agree with my answer. If you need a more complex Pattern$ syntax in the future, we could make a feature request to Fred for this ExamineDirectory function.

Rgrds

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by pantera.

Hi fweil,
I was thinking about searching several filetypes.
Since there are 20+ filetypes i wanted to scan for, reading with the "*.*" Pattern into a list of somekind, and loop searching through all 20+ files is doesn't feel that appealing. I assume it will take too much of the cpu/ide-bus resourses to be usefull.

Scanning with the option of one of the files every iteration and compiling it afterwards would probably yield even more use of the bus.

Thats why i wanted to do something like:

Code: Select all

ExamineDirectory(0, "C:\", "*.exe,*.bat,*.inf")
[\code]
Post Reply