Skip to content

Process

Introduction

Run a custom command.

Options

  • cmd: the binary to call
  • args: the list of arguments to pass to the binary, {var} in either will be replaced by the variables below
  • timeout: maximum time in milliseconds to wait for the process to finish (default: 30000); use null to wait indefinitely

Available variables

  • path: the file absolute path
  • dir: the directory absolute path
  • filename: the full file name (including the extension)
  • basename: the file name without the extension (until the last dot)
  • ext: the file extension (starting from the last dot)
  • /: the native separator of your platform (\ on Windows, / on UNIX)

Output variables

  • {process.output}: stdout of the process, with the trailing newline stripped
  • {process.exit_code}: exit code as an integer

Examples

{
    "type": "process",
    "cmd": "magick",
    "args": ["{path}", "-resize", "150x150", "{dir}/{basename}_150x150.{ext}"]
}

Using output variables to rename a file based on what a script prints:

{
    "type": "multiple",
    "actions": [
        {
            "type": "process",
            "cmd": "my-tagger",
            "args": ["{path}"]
        },
        {
            "type": "rename",
            "from": ".*",
            "to": "{process.output|trim}.{ext}"
        }
    ]
}