Hello, I'm a little behind on reading the ML, so maybe you already have your
answer.
I have a script that reads a list of filenames from a file and then ftp's
the files to my web site.  Perhaps if you can get the directory contents
into a list (rather than from a file), you can adapt this to your need.

Elliott

On 22-Oct-99, [EMAIL PROTECTED] wrote:

> OK, I'm stuck.
> 
> I'm trying to read the contents of every file in a directory and use 
> the contents of each file in a foreach statement.
> 
> For example...
> 
> foreach file load %/boot/home/webdata/news/ [print file]
> 
> foreach file read %/boot/home/webdata/news/ [print file]
> 
> Both of these statements simply print the name of the file.
> 
> 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 ] )
> 
> Thanks in advance for any help.
> 
> Ryan Christiansen
> 
> 
REBOL [
   Title:   "List FTP upload"
   Date:    22-Jun-1999
   Version: 1.0
   File:    %listftpupload.r
   Home:    http://www.qsl.net/n0ukf/
   Author:  "Elliott Olson"
   Email:   [EMAIL PROTECTED]
   Purpose: {
      FTP upload multiple files using login and password.
      Supports a full upload or partial for updates
      from lists in %sitedata.reb and %siteupdate.reb.
      }
   Comment: {
      Edit the site: line for username, password, site address and directory
      Edit filepath: line to direct the script to the directory containing files for 
the site
      Change sitedata.reb and siteupdate.reb to your list filenames. 
      Make 2 files, one for full site upload containing the names of all files 
starting with %,
      one per line, and one for updates containing the names of only those files that 
will be updated
      (html pages, other changed or added files), one per line.  Save as ASCII text 
files.
      }
      ]

which: ask " Is this a full site upload (y/n)? "
site: ftp://username:[EMAIL PROTECTED]/directory/
filepath: %/c/full/path/filedir/   ;path to directory containing files for the site

files: load either which = "y" [%sitedata.reb] [%siteupdate.reb]
;change sitedata.reb and siteupdate.reb to your list filenames.

foreach file files [
    print file
    write/binary join site file read/binary file
    ]

Reply via email to