Directory/File issue... Re:
[1/3] from: al::bri::xtra::co::nz at: 30-Sep-2000 8:41
Terry Brownell wrote:
> Q. How can I read a text file with Rebol, when I'm not sure what the file
name actually is?
> I want to process every file in the directory, but how?
>> print mold read %/c/rebol/
[%Component/ %Rebol stuff/ %Old_Rebol/ %Association/ %Site/ %Plug-in/
%Include/ %RebMail/ %Patch/ %HTML/]
>> directory: read %/c/rebol/Site/
== [%Site.r %Page/]
>> read join %/c/Rebol/Site/ first directory
== {[
Rebol [
^-Name: 'Site
^-Title: "Site"
^-File: %"Site.r"
^-Date: 29/September/2000
^-Author: "Andrew Martin"
^-eMail: [Al--Bri--x]...
I hope that helps!
Andrew Martin
Caution - Jedi Knight at work...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
http://members.xoom.com/AndrewMartin/
[2/3] from: ryanc:iesco-dms at: 29-Sep-2000 13:51
[tbrownell--yahoo--com] wrote:
> Hello.
> I have a unique situation that involves .txt log files
<<quoted lines omitted: 4>>
> Q. How can I read a text file with Rebol, when I'm not
> sure what the file name actually is?
dir-list: read %. ;note the period
>
> I want to process every file in the directory, but
> how?
foreach f dir-list [if not dir? f [ print f ]]
>
> Terry Brownell
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
> http://photos.yahoo.com/
--Ryan
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge. Knowledge is
limited. Imagination encircles the world.
-Einstein
[3/3] from: joel:neely:fedex at: 29-Sep-2000 21:47
Just an additional bit of gilding on the lilly...
[ryanc--iesco-dms--com] wrote:
>
> dir-list: read %. ;note the period
>
I've had a couple of odd situations in which operations on directories
behaved oddly unless I also put the closing "/" at the end of the
directory name, so I've just gotten really picky about doing that
myself. YMMV.
> >
> >
> > I want to process every file in the directory, but
> > how?
>
> foreach f dir-list [if not dir? f [ print f ]]
>
Based on my paranoia above...
foreach f read %./ [if not dir? f [ dosomethingto f]]
-jn-
--
; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677
REBOL [] print to-string debase decompress #{
789C0BCE0BAB4A7176CA48CAB53448740FABF474F3720BCC
B6F4F574CFC888342AC949CE74B50500E1710C0C24000000}
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted