Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Filtering files in directories.

From: chris:ross-gill at: 2-Jan-2003 14:42

Hi Ed, Ok, this is neither pattern matching (works by suffix) nor does it bypass the need to load a full list of files (not sure there's any other way to do it), but it can be hacked relatively easily for your own needs. Usage:
>> read-filter %./ %.jpg >> read-filter %./ [%.html %.r]
It also retains directories, but that could be dropped from the source. - Chris -- read-filter: func [ loc [file! url!] "Path to Read" sfx [file! block!] "Suffix to Search For" /local files ][ return either exists? loc: dirize loc [ files: read loc remove-each file files [ not any [ ; Conditions to retain files dir? join loc file sfx = suffix? file find sfx suffix? file ] ] files ][ none ] ]