tasks/ftp_upload.js
function ftpCwd(inPath, cb) {
    ftp.raw.cwd(inPath, function(err) {
      if (err) {
        ftp.raw.mkd(inPath, function(err) {
          if (err) {
            log.error('Error creating new remote folder ' + inPath + ' --> ' + err);
            cb(err);
          } else {
            log.ok('New remote folder created ' + inPath.yellow);
            ftpCwd(inPath, cb);
          }
        });
      } else {
        cb(null);
      }
    });
  }
function ftpCwd(inPath, cb) {
    ftp.raw.cwd(inPath, function(err) {
      if (err) {
        ftp.raw.mkd(inPath, function(err) {
          if (err) {
            log.error('Error creating new remote folder ' + inPath + ' --> ' + err);
            cb(err);
          } else {
            log.ok('New remote folder created ' + inPath.yellow);
            ftpCwd(inPath, cb);
          }
        });
      } else {
        cb(null);
      }
    });
  }
function ftpCwd ( inPath , cb ) { ftp . raw . cwd ( inPath , function ( err ) { if ( err ) { ftp . raw . mkd ( inPath , function ( err ) { if ( err ) { log . error ( 'Error creating new remote folder ' + inPath + ' --> ' + err ) ; cb ( err ) ; } else { log . ok ( 'New remote folder created ' + inPath . yellow ) ; ftpCwd ( inPath , cb ) ; } } ) ; } else { cb ( null ) ; } } ) ; }
A method for changing the remote working directory and creating one if it doesn't already exist
A method for changing the remote working directory and creating one if it doesn t already exist