Filebot bash script and file globs

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

Filebot bash script and file globs

Post by joegoldman »

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?

Thanks,
Joe
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot bash script and file globs

Post by rednoah »

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? ➔ https://askubuntu.com/a/674347


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
:idea: Please read the FAQ and How to Request Help.
joegoldman
Posts: 6
Joined: 12 Mar 2018, 03:36

Re: Filebot bash script and file globs

Post by joegoldman »

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 $@, since this custom script of mine only takes file globs as arguments.
Post Reply