pentaho/pentaho-kettle · error · KettleException

JobFTPS.Error.MovingFileToFolder

JobFTPS.Error.MovingFileToFolder

Error message

JobFTPS.Error.MovingFileToFolder

What it means

FTP client failure in FTPSConnection.moveToFolder (called from downloadFiles): renaming the remote file into the target folder failed. The localized message wraps the cause, commonly a missing destination folder or insufficient permissions on the remote host.

Solutions

  1. Ensure the target folder exists first (call createDirectory on it)
  2. Check for and remove/rename name collisions in the target folder
  3. Verify the FTPS user has rename/write permissions in both source and target folders
  4. Test RNFR/RNTO manually with an FTPS client to see the exact server reply

Example fix

// before
connection.moveToFolder(file, "/data/processed");
// after
connection.createDirectory("/data/processed"); // ensure target exists
connection.moveToFolder(file, "/data/processed");
Defensive patterns

Strategy: validation

Validate before calling

try {
  connection.createDirectory(targetFoldername); // idempotent-ish; ensure target exists
} catch (KettleException e) {
  // ignore 'already exists' style replies
}

Try / catch

try {
  connection.moveToFolder(file, target);
} catch (KettleException e) {
  logError("Move of " + file.getName() + " to " + target + " failed", e);
  throw e;
}

Prevention

When it happens

Trigger: downloadFiles -> moveToFolder(fromFile, targetFoldername) when RNFR/RNTO fails: target folder missing, a file with the same name exists there, permissions, or connection loss

Common situations: 'move to folder' job setting points to a directory that was never created; target filename collision; server does not allow rename across directories

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/5b2ce7c000abd2da. Report an issue: GitHub.

Appendix: source

Thrown at plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/FTPSConnection.java:555

      throw new KettleException( BaseMessages.getString( PKG, "JobFTPS.Error.DeletingFile", filename ), e );
    }
  }

  /**
   *
   * this method is used to move a file to remote directory
   *
   * @param fromFile
   *          File on remote host to move
   * @param targetFoldername
   *          Target remote folder
   * @throws KettleException
   */
  public void moveToFolder( FTPFile fromFile, String targetFoldername ) throws KettleException {
    try {
      this.connection.renameFile( fromFile, new FTPFile( targetFoldername, fromFile.getName() ) );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "JobFTPS.Error.MovingFileToFolder", fromFile
        .getName(), targetFoldername ), e );
    }
  }

  /**
   *
   * Checks if a directory exists
   *
   * @return true if the directory exists
   *
   */
  public boolean isDirectoryExists( String directory ) {
    String currectDirectory = null;
    boolean retval = false;
    try {
      // Before save current directory
      currectDirectory = this.connection.getWorkDirectory();
      // Change directory

View on GitHub (pinned to f3058517a1)