lib/smb/client/client_helper.rb
def get(from, to = nil, overwrite = false, raise = true)
      # Create a new tempfile but delete it
      # The tempfile.path should be free to use now
      tempfile = Tempfile.new
      to ||= tempfile.path
      tempfile.unlink

      if !overwrite && File.exist?(to)
        raise Client::RuntimeError, "File [#{to}] already exist locally"
      end
      from = '"' + from + '"' if from.include? ' '
      exec 'get ' + from + ' ' + to
      to
    rescue Client::RuntimeError => e
      raise e if raise
      false
    end
def get(from, to = nil, overwrite = false, raise = true)
      # Create a new tempfile but delete it
      # The tempfile.path should be free to use now
      tempfile = Tempfile.new
      to ||= tempfile.path
      tempfile.unlink

      if !overwrite && File.exist?(to)
        raise Client::RuntimeError, "File [#{to}] already exist locally"
      end
      from = '"' + from + '"' if from.include? ' '
      exec 'get ' + from + ' ' + to
      to
    rescue Client::RuntimeError => e
      raise e if raise
      false
    end
def get ( from , to = nil , overwrite = false , raise = true ) # Create a new tempfile but delete it # The tempfile.path should be free to use now tempfile = Tempfile . new to ||= tempfile . path tempfile . unlink if ! overwrite && File . exist? ( to ) raise Client :: RuntimeError , "File [#{to}] already exist locally" end from = '"' + from + '"' if from . include? ' ' exec 'get ' + from + ' ' + to to rescue Client :: RuntimeError => e raise e if raise false end
Receive a file from the smb server to local.
 If +to+ was not passed, a tempfile will be generated.
 @param [String] from The remote file to be read
 @param [String] to local file path to be created
 @param [Boolean] overwrite Overwrite if exist locally?
 @param [Boolean] raise raise Error or just return +false+
 @return [String] path to local file
Receive a file from the smb server to local . If + to + was not passed a tempfile will be generated .