# File lib/fakefs/file_system.rb, line 55
    def clone(path, target = nil)
      path    = RealFile.expand_path(path)
      pattern = File.join(path, '**', '*')
      files   = if RealFile.file?(path)
                  [path]
                else
                  [path] + RealDir.glob(pattern, RealFile::FNM_DOTMATCH)
                end

      files.each do |f|
        target_path = target ? f.gsub(path, target) : f

        if RealFile.symlink?(f)
          FileUtils.ln_s(RealFile.readlink(f), f)
        elsif RealFile.file?(f)
          FileUtils.mkdir_p(File.dirname(f))
          File.open(target_path, File::WRITE_ONLY) do |g|
            g.print RealFile.read(f)
          end
        elsif RealFile.directory?(f)
          FileUtils.mkdir_p(target_path)
        end
      end
    end