@file syntax for reading cmdline args from text files
Posted: 07 Dec 2015, 07:17
Passing complex arguments that contain lots of special characters like $ ! % ' " to a command-line tool can be tricky. Correctly escaping such arguments for cmd or bash can get very painful very quickly.
Argument List:
FileBot allows you specify argument files via @/path/to/file syntax, so you can pass in your complex command-line arguments via separate text files line by line without having to worry about quoting or escaping anything.
e.g. @file usage
e.g. /path/to/args.txt
DO NOT quote "arguments" in @files. Your arguments are "quoted" implicitly by the new line separator.
DO NOT add trailing space characters. Any character that is not the new line separator is interpreted as literal argument value, including leading and trailing (i.e. invisible) space and tab characters.
DO NOT use Microsoft tools such as Notepad or Word to edit plain text files. Use tools such as Notepad++ or Sublime Text instead.
Option Value:
The --format, --mapper, --filter and --file-filter options accept Groovy expressions literally, or as *.groovy UTF-8 encoded plain text files:
e.g. --format *.groovy (UTF-8 encoded plain text file)
Script Parameter Value:
You may also pass --def script binding values via UTF-8 encoded plain text files. That's handy when passing in complex multi-line formats.
e.g. --def [email protected] usage
e.g. /path/to/MovieFormat.groovy (UTF-8 encoded plain text file)
Format Value:
The format value itself allows for another level of redirection that is applicable to both GUI and CLI usage, so you can use the same @format.groovy syntax in both GUI and CLI.
e.g. read format from an external *.groovy text file

Argument List:
FileBot allows you specify argument files via @/path/to/file syntax, so you can pass in your complex command-line arguments via separate text files line by line without having to worry about quoting or escaping anything.
e.g. @file usage
Code: Select all
filebot @/path/to/args.txt
Code: Select all
-script
fn:amc
/input
--output
/output
--action
duplicate
--def
movieFormat=Movies/{ny}/{fn}
seriesFormat=TV/{n}/{'S'+s}/{fn}
animeFormat=Anime/{n}/{fn}



Option Value:
The --format, --mapper, --filter and --file-filter options accept Groovy expressions literally, or as *.groovy UTF-8 encoded plain text files:
e.g. --format *.groovy (UTF-8 encoded plain text file)
Code: Select all
--format /path/to/MovieFormat.groovy
Script Parameter Value:
You may also pass --def script binding values via UTF-8 encoded plain text files. That's handy when passing in complex multi-line formats.
e.g. --def [email protected] usage
Code: Select all
filebot -script fn:amc /input --output /output --def movieFormat=@/path/to/MovieFormat.groovy
Code: Select all
Movies/{
[ allOf {ny}
{ allOf {vf}
{group}
}
, allOf {ny}
{'CD'+pi}
{lang}
]*.findResults {
if (it) it.toString()
.replaceAll(/[!?.]+$/)
.asciiQuotes()
}*.join(' ')
.join('/')
}
Format Value:
The format value itself allows for another level of redirection that is applicable to both GUI and CLI usage, so you can use the same @format.groovy syntax in both GUI and CLI.
e.g. read format from an external *.groovy text file
Code: Select all
@/path/to/format.groovy
