glob syntax

Wednesday, 11 April 2012 · 3 messages
DL
David Leigh11 Apr 2012 14:08 #
I'm trying to use the CREATEFILTER directive to: . Include all files WITHOUT an extension . Exclude all files WITH an extension . Exclude the specific file "_cache" (note, it has NO extension) . Do all this for a whole directory tree I notice that CREATEFILTER uses "glob syntax" (http://docs.basex.org/wiki/Commands#Glob_Syntax) Questions: 1. Since this is a java program, does that mean that: http://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob and http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPa thMatcher%28java.lang.String%29 provide the exact full description of "glob syntax" for BaseX? 2. If so, can I do what I want to do with some sort of a "!" (negation) pattern? 3. Should this work with version 6.3.5 of BaseX? Thanks! David
 <mailto:david at leighweb.com> DavidEmailSig
CG
Christian Grün11 Apr 2012 17:31 #
Hi David, the CREATEFILTER option can only be used to include files for parsing. To exclude files, the best alternative is to write a little XQuery and do some string matching by yourself, as e.g. shown in the following example:
   let $root := "/path/to/files/"
   for $file in file:list($root, true())
   where matches($file, "your pattern")
   return db:add("database", $root || $file, $file)
Quoted text · David Leigh · 1 line
> 1. Since this is a java program, does that mean that:
..unfortunately, there is no standard glob parser in Java (in fact, most glob parsers have subtle differences and are often os-dependent).
Quoted text · David Leigh · 1 line
> 3. Should this work with version 6.3.5 of BaseX?
I highly recommend to switch to our latest version, as we can't offer any support for older versions of BaseX (except for commercial customers). Hope this helps, Christian
DL
David Leigh11 Apr 2012 19:11 #
Thank you for the quick response as always. When I get around to actually getting into this (and upgrading to the current version), I'm sure I'll be back with some questions. It looks promising. David
Quoted text · Christian Grün · 23 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: Wednesday, April 11, 2012 05:31 PM To: david at leighweb.com Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] glob syntax Hi David, the CREATEFILTER option can only be used to include files for parsing. To exclude files, the best alternative is to write a little XQuery and do some string matching by yourself, as e.g. shown in the following example: let $root := "/path/to/files/" for $file in file:list($root, true()) where matches($file, "your pattern") return db:add("database", $root || $file, $file) > 1. Since this is a java program, does that mean that: ..unfortunately, there is no standard glob parser in Java (in fact, most glob parsers have subtle differences and are often os-dependent). > 3. Should this work with version 6.3.5 of BaseX? I highly recommend to switch to our latest version, as we can't offer any support for older versions of BaseX (except for commercial customers). Hope this helps, Christian

⚡Generated with XQuery