Filebot bash script and file globs

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
Posts: 6
Joined: 12 Mar 2018, 03:36

Filebot bash script and file globs

Post by joegoldman » 13 Jun 2018, 01:54

Hi forum,

Trying to run filebot in a bash script and pass through a file glob i.e. Show.Name.S01*/*.mkv

File globs run fine if I run the command myself however running in a script I can only ever get it to match first option.

Since file globs are apparently passed into scripts as an array, the obvious solution is to loop over the array - however the only way I can see this working is spawning a new instance of filebot for every episode which increases processing time significantly, with multiple lookups etc. I'd rather it batch process.

Has anyone found a way around this? Can a file list be read-in from a temporary file? What other easy solutions may there be to get around this issue?


User avatar
The Source
Posts: 13531
Joined: 16 Nov 2011, 08:59
Location: Taipei

Re: Filebot bash script and file globs

Post by rednoah » 13 Jun 2018, 06:05

What is the command you're running? What does the console output say? What have you tried so far to narrow down the issue?

:idea: Is this a bash question, or a filebot question? ➔

e.g. it works as far as filebot is concerned, everything is passed in a single filebot call:

Code: Select all

$ filebot -script fn:sysenv *.mkv
# Arguments #
args[0] = -script
args[1] = fn:sysenv
args[2] = A.mkv
args[3] = B.mkv
My (very excellent) support depends on Windows Store and Mac App Store sales and Patreon support. Paying users, donors and everyone who contributes to FileBot in one way or another will get the very best support.

:idea: Please read the FAQ and How to Request Help.

Posts: 6
Joined: 12 Mar 2018, 03:36

Re: Filebot bash script and file globs

Post by joegoldman » 13 Jun 2018, 10:37

You are correct its more a bash question then a filebot question, was more hoping someone had come to this issue.

Your post, however, put me in the right direction of how globs are handled. I was lead to believe they are passed straight into the script as an intact array so if its argv[1] is itself an array of all the results, but as you demonstrated the glob expands itself before passing through so each matching file path is actually a new argument, so now I access them through [email protected], since this custom script of mine only takes file globs as arguments.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests