Global.helma.Ssh.put (localFile, remoteDir, mode)
copies a file to the remote server

  • Parameter String:
    path to local file that should be copied to remote server. If the argument is a String Array, all files specified in the Array are copied to the server
  • Parameter String:
    path to remote destination directory
  • Parameter String:
    (optional) 4-digit permission mode string (eg. "0755");
  • Returns
    Boolean
Sourcecode in /home/hannes/helma/modules/helma/Ssh.js:
211:   this.put = function(localFile, remoteDir, mode) {
212:           if (!localFile || !remoteDir) {
213:               error("put", "Insufficient arguments.");
214:           } else if (!this.isConnected()) {
215:               error("put", "Not connected. Please establish a connection first.");
216:           } else {
217:               try {
218:                   var scp = connection.createSCPClient();
219:                   if (mode != null)
220:                      scp.put(localFile, remoteDir, mode);
221:                  else
222:                      scp.put(localFile, remoteDir);
223:                  debug("put", "copied '" + localFile + "' to '" + remoteDir + "'");
224:                  return true;
225:              } catch (e) {
226:                  error("put", e);
227:              }
228:          }
229:          return false;
230:      }