def file_write(filepath, newcontent, backup=false)
      if self.file_exists?(filepath)
        self.cp filepath, "#{filepath}-previous" if backup
      end
      
      content = StringIO.new
      content.puts newcontent
      self.file_upload content, filepath
    end
def file_write(filepath, newcontent, backup=false)
      if self.file_exists?(filepath)
        self.cp filepath, "#{filepath}-previous" if backup
      end
      
      content = StringIO.new
      content.puts newcontent
      self.file_upload content, filepath
    end
Write +newcontent+ to remote +filepath+. If the file exists
 it will be overwritten. If +backup+ is specified, +filepath+
 will be copied to +filepath-previous+ before appending.