fileutils.rb

Path: fileutils.rb
Last Update: Sun May 09 23:34:44 GMT+10:00 2004

fileutils.rb

Copyright © 2000-2003 Minero Aoki <aamine@loveruby.net>

This program is free software. You can distribute/modify this program under the same terms of ruby.

module FileUtils

Namespace for several file utility methods for copying, moving, removing, etc.

Module Functions

  cd(dir, options)
  cd(dir, options) {|dir| .... }
  pwd()
  mkdir(dir, options)
  mkdir_p(dir, options)
  rmdir(dir, options)
  ln(old, new, options)
  ln(list, destdir, options)
  ln_s(old, new, options)
  ln_s(list, destdir, options)
  ln_sf(src, dest, options)
  cp(src, dest, options)
  cp(list, dir, options)
  cp_r(src, dest, options)
  cp_r(list, dir, options)
  mv(src, dest, options)
  mv(list, dir, options)
  rm(list, options)
  rm_r(list, options)
  rm_rf(list, options)
  install(src, dest, mode = <src's>, options)
  chmod(mode, list, options)
  touch(list, options)

The options parameter is a hash of options, taken from the list +:force+, +:noop+, +:preserve+, and +:verbose+. +:noop+ means that no changes are made. The other two are obvious. Each method documents the options that it honours.

All methods that have the concept of a "source" file or directory can take either one file or a list of files in that argument. See the method documentation for examples.

There are some `low level’ methods, which does not accept any option:

  uptodate?(file, cmp_list)
  copy_file(srcfilename, destfilename)
  copy_stream(srcstream, deststream)
  compare_file(file_a, file_b)
  compare_stream(stream_a, stream_b)

module FileUtils::Verbose

This module has all methods of FileUtils module, but it outputs messages before acting. This equates to passing the +:verbose+ flag to methods in FileUtils.

module FileUtils::NoWrite

This module has all methods of FileUtils module, but never changes files/directories. This equates to passing the +:noop+ flag to methods in FileUtils.

Classes and Modules

Module FileUtils
  ::Module FileUtils::NoWrite
  ::Module FileUtils::Verbose

[Validate]