Hi Andy,
On 14.11.2011, at 13:28, Andy Bunce wrote:
Hi,
I was looking for this feature in version 7. https://mailman.uni-konstanz.de/pipermail/basex-talk/2011-January/000994.htm... says it was temporarily removed from the GUI but create fs [name] [path]
gives an error in 7.0.1. Is this feature gone for good now?
depends on what you want to achieve.
The 'create fs' command walked a given file hierarchy and produced a FSML database (Filesystem Markup Language). Whenever a 'known file type' has been encountered, a file-type specific extractor took care of it and added information about that file (ID3 tags for mp3 files, full text for pdf files etc.) to the FSML mapping. This provided the basis to later on 'query' the filesystem data.
That code has been separated from BaseX, in order to keep the core clean. Moreover, the need for some external libraries to extract metadata has been against our wish to keep BaseX as independent as possible.
If you just wish to produce a FSML mapping, XQuery using EXPath File Module [1] functionality can pretty much do the job:
declare namespace fs = "http://basex.org/fs";
declare function fs:parse($path as xs:string) as element() { let $name := replace($path, ".*[\/]", "") return if(file:is-directory($path)) then <dir name="{ $name }">{ for $f in file:list($path) return fs:parse($f) }</dir> else <file name="{ $name }" size="{ file:size($path) }" /> };
If you also want to have the extractor functionality ... we thought about packaging [2] it for BaseX and make it available as XQuery functions. Just give us a hint and we will get going.
Thanks, Alex
[1] http://docs.basex.org/wiki/File_Functions [2] http://docs.basex.org/wiki/Packaging