Rename a file

Use this step to rename a file

Last published at: May 14th, 2024

renameFile Step

Description:

Rename the existing file with new name. If the new filename has an extension, the file is renamed using the new filename and it's extension. If the new file name doesn't have the extension, then file is renamed with new filename and the source file name extension.

Inputs

  • newFileName – File name to be renamed to.Ex: - testFile.txt to testFile_Old.txt (or) testFile.txt to testFile.html
  • filePath - path of the source directory where the file resides
  • newFilePathVarGlobal – Variable/Global to store new file path


Returns

  • True – step executed successfully
  • False – step failed to execute 


Usage:



Example:

Let’s build and execute the renameFileDef example.          

  • Create a new definition called “renameFileDef
  • Select the definition and click the “design” button
  • Drag a renameFile step from the toolbox and connect the dots as shown in graphic above
  • Click on the “renameFile” step to configure its properties as shown on the below graphic. Provide the actual path information (on the server) 

  • Save the process definition. Create a new process instance and execute. The process step rename existing file in server and the new file path is stored in the variable.filePath as configured.