Page 1 of 1

[Script] Run custom Preset from the command-line

Posted: 31 Mar 2026, 04:52
by rednoah
The FileBot Desktop application and the filebot command-line tool are separate by design - one does not effect the other - but if you want to run a Preset that you have configured in the Desktop application from the command-line, then you can use this simple glue logic script to run a filebot -rename command with all the command-line options (e.g. custom format, database, episode order, etc) filled in from the selected Preset.


Usage:

Shell: Select all

filebot -script /path/to/preset.groovy --def name="Organize Episodes for Plex" /path/to/input

Glue Logic Script:

Groovy: Select all

#!/usr/bin/env -S filebot -script

def preset = net.filebot.ui.rename.UserPresets.findResult{ g ->
	return g.list().find{ p -> p.name == name }
}

if (preset == null) {
	die "Preset does not exist: $name"
}

log.fine "Run Preset: $preset"

rename(
	file: args,
	action: preset.action,
	db: preset.database,
	format: preset.format,
	order: preset.sortOrder,
	strict: preset.matchMode ==~ /Strict/,
	lang: preset.language
)