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

simple, yet frustrating

 [1/3] from: balayo:mindspring at: 25-Sep-2000 19:11

howdy list, This doesn't seem to be the time to be asking *really* easy questions, but I'm frustrated enough to go for it anyway. this is ftpdownload.r, sans the interactive part. site: pattern: "*.gz" files: read site foreach file files [ if find/match/any file pattern [ write/binary file read/binary site/:file ] ] what I can't seem to do is have this fetch "*.gz" files, but not "gz.bak" files. I don't want the backups (later, I'll modify this to delete them). of course, the site and pattern have been changed to protect the innocent. thanks for your patience... -- Spend less time composing sigs. -tom

 [2/3] from: rebol::techscribe::com at: 25-Sep-2000 17:36

Hi Tom, gz.bak certainly contains the patter "*.gz", so you shouldn't be too surprised that it qualifies for find. I have to run, but one quick and dirty way to accomplish what you're trying to do would be to say: bak-pattern: "*.gz.bak" pattern: "*.gz" if all [ find/match/any file pattern not found? find/match/any file bak-pattern ] [ do whatever it is you must do ... ] At 07:11 PM 9/25/00 +0100, you wrote:
>howdy list, >This doesn't seem to be the time to be asking *really* easy
<<quoted lines omitted: 15>>
>Spend less time composing sigs. >-tom
;- Elan [ : - ) ] author of REBOL: THE OFFICIAL GUIDE REBOL Press: The Official Source for REBOL Books visit me at

 [3/3] from: joel:neely:fedex at: 25-Sep-2000 20:01

Hi, Tom... [balayo--mindspring--com] wrote:
> site: > pattern: "*.gz"
<<quoted lines omitted: 6>>
> what I can't seem to do is have this fetch "*.gz" files, but not > "gz.bak" files.
The gotcha here is that find/match/any will accept any match of the pattern, regardless of position. Take a look at this excerpt from my box (some names changed/deleted for security):
>> foreach filename sort read %./ [
[ if find/match/any filename "*.gz" [print filename] [ ] analog3_32_tar.gz blort.gz.bak enterprise-4.2-export-us.hppa1.1-hp-hpux10.10.tar.gz foo.gz.bak labrea.gz.tar == none Since the pattern "*.gz" can match anywhere the sequence ".gz" appears in the file name (even internally), I get lots of false hits. To force it to appear only at the end, I can specify a parse rule that only matches in that case:
>> foreach filename sort read %./ [
[ if parse/all filename [thru ".gz"] [print filename] [ ] analog3_32_tar.gz enterprise-3.6-export-us.hppa1.1-hp-hpux10.10.tar.gz == none This is based on the fact that parse/all string rule returns true only if we get all the way to the end of the string, therefore the ".gz" must occur in the string and must be at the end. Hope this helps! -jn-

  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted