diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index 6bc07fb0..c7a19867 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -308,7 +308,7 @@ def _renameFunction(fn) { if (fn instanceof String) return StandardRenameAction.forName(fn) if (fn instanceof Closure) - return [rename:fn as Closure, toString:{'CLOSURE'}] as RenameAction + return [rename:{ from, to -> def result = fn.call(from, to); result instanceof File ? result : to }, toString:{'CLOSURE'}] as RenameAction return fn as RenameAction }