From: fantam::mailandnews::com at: 30-Apr-2001 16:45
The following is one of my favorite swiss-knife function, so I
thought I'd share it on this list. It is used to build blocks of
files given a directory, with or without filter.
Here it goes:
Title: "mezzanine function"
Description: "Find files under a given directory"
or, with filter:
make-pool/filter %"/d/web sites/rebol/" "htm gif jpg"
make-pool: func [root-folder [file!]
/filter extension [string!]
/verbose "prints message"
files: copy 
if found? filter [
extension: parse extension none
if not (length? extension) = 1 [
extension: next extension
while [not tail? extension] [insert extension to-word "|" extension: next next extension]
extension: head extension
recursive: func [dir [file!] /local ext] [
foreach file read dir [
either not dir? dir/:file [
either found? filter [
if not none? ext: find/last file "." [
if parse next ext extension [append files dir/:file]
append files dir/:file
either dir? root-folder
recursive dirize root-folder
print [mold root-folder "no valid folder"]
if verbose [print reduce [length? files "files in pool."]]