Help for a newbie
[1/7] from: learned::yuck::net at: 7-Jun-2001 16:07
I am just embarking on learning REBOL, and playing with data types in an
effort to become comfortable with them. My question relates to blocks,
files and find.
If I read a directory as in:
a: read %.
and then try to find a file name within a, I consistantly receive a null
response. What am I missing? I am trying things such as:
find a "foo.txt"
find a %foo.txt
Thanks
Ed
[2/7] from: gjones05:mail:orion at: 8-Jun-2001 5:28
From: "Gary Learned"
> I am just embarking on learning REBOL, and playing with data types in an
> effort to become comfortable with them. My question relates to blocks,
<<quoted lines omitted: 5>>
> find a "foo.txt"
> find a %foo.txt
Hi, again, Ed,
>> a: read %.
== [%view/ %nutshell_files/ %tensteps_files/ %library/ %archives/ %users-guide/
%rebol-co
mmand/ %REBOL-View User's Guide_files/...
>> find a "foo.txt"
== none
>> find a %foo.txt
== none
If by null, you mean none, then, in my case the find is returning the correct
result, which meanse that neither the string type "foo.txt" nor the file type
%foo.txt have been found in the block. This was why yesterday I jokingly said
that the file name *does* need to exist. Using the output directly from the
console, you can see that if a small file is added to the directory, it is then
found by the find.
>> write %foo.txt "bar"
>> a: read %.
== [%view/ %nutshell_files/ %tensteps_files/ %library/ %archives/ %users-guide/
%rebol-co
mmand/ %REBOL-View User's Guide_files/...
>> find a %foo.txt
== [%foo.txt]
>> delete %foo.txt
Does that help?
--Scott Jones
[3/7] from: carl:cybercraft at: 8-Jun-2001 22:38
On 08-Jun-01, Gary Learned wrote:
> I am just embarking on learning REBOL, and playing with data types
> in an effort to become comfortable with them. My question relates to
<<quoted lines omitted: 5>>
> find a "foo.txt"
> find a %foo.txt
Hmmm. The second one is correct and should be working if foo.txt is
the full filename. That should return something like...
== [%foo.txt %otherfoo.txt]
b: read first find a %foo.txt
should read the foo.txt text into b... ?
--
Carl Read
[carl--cybercraft--co--nz]
[4/7] from: sanghabum:aol at: 8-Jun-2001 6:47
Hi Ed,
> If I read a directory as in:
>
> a: read %.
>
> and then try to find a file name within a, I consistantly receive a null
> response. What am I missing? I am trying things such as:
>
> find a "foo.txt"
> find a %foo.txt
Find a %foo.txt
works fine for me. Are you sure you are reading the
directory you think you are reading? Try:
a: read %.
foreach xx a [print xx]
And see if foo.txt is listed.
Another possibility:
Is foo.txt a directory? If so, your Find should be:
find a %foo.txt/
--Colin
[5/7] from: jean:holzammer:faedv-n:bayern at: 8-Jun-2001 12:53
> a: read %.
>
> and then try to find a file name within a, I consistantly receive a null
> response. What am I missing? I am trying things such as:
> find a %foo.txt
Are you sure , the current directory (%.) is the directory, foo.txt is in ?
To check the current dir, use
> what-dir
to ensure, that foo.txt is actually in block a, do
>probe a
Jean
[6/7] from: stefan:falk:slg:se at: 8-Jun-2001 12:54
Hi,
I'd use
path: %.
foreach file read path [
if find file "foo.txt" [print file]
]
/Regards Stefan "Syke" Falk - www.amigaextreme.com
[7/7] from: learned:talentsinc at: 8-Jun-2001 11:00
Yes, I'm sure it's in there, I can do a print of 'a' after the read and see
the data there. I just get null responses on the file search. others have
told me I need to search for %foo.txt as I am searching for a piece of data
of type file, but I haven't had a chance to try that yet. I will report
back later today.
--On Friday, June 08, 2001 12:53 PM +0200 "Holzammer, Jean"
<[Jean--Holzammer--faedv-n--bayern--de]> wrote:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted