Skip to content

SplitFile Command: splitFile

The splitFile command divides a file into smaller files based on a specified number of lines. This helps manage large datasets, improve processing efficiency, and facilitate data handling in automation workflows.

Example: Suppose you have a file C:\Data\LargeFile.txt and you want to split it into smaller files, each containing 5 lines.

Steps to configure:

  1. Select Set a Variable from the Action dropdown.
  2. Enter a variable name in the Element Key field (e.g., SplitStatus). This variable will store the result.
  3. Click on Form to open the configuration window.
  4. Select Functions from the dropdown, then choose File handler Functions as the function.
  5. In the Cmd field, select splitFile.
  6. Provide the following parameters:
    • Source: Path to the file to be split (e.g., C:\Data\LargeFile.txt).
    • LineNos: Number of lines per split file (e.g., 5).
  7. Click Save.
scrn-splitfile-command-tabular-view
Tabular View
scrn-splitfile-command-card-view
Card View

Outcome:

  • The specified file is divided into smaller parts based on the number of lines per split.
  • The split files are named sequentially in the format <OriginalFileName>_1.<Extension>, <OriginalFileName>_2.<Extension>, and so on (e.g., LargeFile_1.txt, LargeFile_2.txt, and so on).
  • The operation status (true or false) is stored in the variable defined in the Element Key field.
  • This variable can be used in later steps of your automation process to reference the stored information using the syntax ${VariableName} (e.g., ${SplitStatus}).

Back To Top