|
Pages: [1]
|
 |
|
Author
|
Topic: Path Question (Read 218 times)
|
|
leke
|
Hi all, I am learning about Paths at the moment. read %. which gives me a list of all the files in my REBOL folder. I wanted to see if I could output only certain types of files, so I tried read %.r and got an error. How could I do 'wildcard' style searches.
|
|
|
|
|
Logged
|
|
|
|
|
CarlRead
|
I don't think there's any way to do wildcard searches using READ, but FIND allows them using the /ANY refinement. So you could use something like this... files: read %. matched: [] foreach file files [if find/any file %*.r [append matched file]] probe matched
Which would perhaps be best turned into a function... dir-find: func [ "Select files in a directory using a wildcard." dir [file!] "Directory path." match [file!] "Wildcard. ie., %*.txt %pic??.jpg" /local files matched ][ files: read dir matched: copy [] foreach file files [if find/any file match [append matched file]] matched ]
(Hope that behaves - not extensively tested.)
|
|
|
|
« Last Edit: August 31, 2004, 02:59:05 AM by CarlRead »
|
Logged
|
- Carl Read
|
|
|
|
|
Pages: [1]
|
|
|
 |