You're very very close! :)

It's printing the filename, cuz that's what you are telling it to do.  Add a
"read" ahead of the filename...before the print... so you print WHAT IS READ
FROM THE FILE, not the filename itself.

foreach file read news_dir [ print READ news_dir/:file ]

Russ

---------
At 07:03 PM 10/23/99 +0000, you wrote:
>I need a little more help.
>
>I'm trying to read the contents of every file in a directory and use 
>the contents of each file in a foreach statement.
>
>What do I need to do to harness the contents of the files instead of 
>the file names themselves?  It is not useful for me to list every file 
>individually (i.e. as a block [ %file.txt %file2.txt ] )
>
>
>;--first try
>
>news_dir: %/boot/home/webdata/news/
>foreach file read %news_dir [ print news_dir/:file ]
>
>** Access Error: Cannot open /boot/home/Desktop/news_dir.
>** Where: foreach file read %news_dir [print news_dir/:file] 
>
>
>;--second try
>
>news_dir: %/boot/home/webdata/news/
>foreach file read %news_dir [ print %news_dir/:file ]
>
>** Syntax Error: Invalid file -- %news_dir/:file.
>** Where: (line 260) foreach file read %news_dir [ print %news_dir/
>:file ] 
>
>
>;--third try
>
>news_dir: %/boot/home/webdata/news/
>foreach file read news_dir [ print news_dir/:file ]
>
>/boot/home/webdata/news/18950604-CASSELTON 
>
>
>
>(right now there is only one file in the directory, but as you can see 
>my script is only printing the NAME of the file and its path, not its 
>contents.)
>
>
>What am I doing wrong?
>
>Thanks.
>
>Ryan Christiansen
>
>
>

Reply via email to