# File lib/fakefs/fileutils.rb, line 140
    def cp_r(src, dest, options = {})
      # handle `verbose' flag
      RealFileUtils.cp_r src, dest, options.merge(noop: true)

      # handle `noop' flag
      return if options[:noop]

      Array(src).each do |source|
        dir = FileSystem.find(source)
        unless dir
          if RUBY_VERSION >= '1.9.1'
            fail Errno::ENOENT, source
          else
            # This error sucks, but it conforms to the original Ruby
            # method.
            fail "unknown file type: #{source}"
          end
        end

        new_dir = FileSystem.find(dest)
        fail Errno::EEXIST, dest if new_dir && !File.directory?(dest)
        fail Errno::ENOENT, dest if !new_dir && !FileSystem.find(dest + '/../')

        # This last bit is a total abuse and should be thought hard
        # about and cleaned up.
        if new_dir
          if src[-2..-1] == '/.'
            dir.entries.each { |f| new_dir[f.name] = f.clone(new_dir) }
          else
            new_dir[dir.name] = dir.entry.clone(new_dir)
          end
        else
          FileSystem.add(dest, dir.entry.clone)
        end
      end

      nil
    end