[Prev][Next][Index][Thread]

Re: Reducing exe size?



Robert Feldt <feldt@ce.chalmers.se> writes:

> Could you give me some pointers to the functions/libraries relevant
> for listing the files in a dir and copying and renaming files? Just
> want to try it out and couldn't find simple example programs on the
> web. And the Dylan books I've ordered haven't arrived yet.

Use libraries:

  use io;
  use system;

Ues modules:

  use format-out;
  use file-system;
  use operating-system;

define method main () => ()
  local method for-each-file( directory, name, type )
    when(type == #"file")
      let old-name = concatenate(directory, name);
      let new-name = concatenate($destination-directory, name);
      format-out("Copying %s to %s\n", old-name, new-name);
      copy-file(old-name, new-name, if-exists: #"replace");
    end when;
  end method for-each-file;

  do-directory(for-each-file, $source-directory);
end method main;

Hope that helps, works with Fun-Dev, I think it works with GD too.

Chris.
-- 
http://www.double.co.nz/dylan



Follow-Ups: References: