Multiple pattern matches on filename
Multiple pattern matches on filename
Hi there,
I've been googling this forum and also the groovy syntax, but can't find an example that matches.
I've trying to move files based on filenames, in this case 4K files. I want to match on 4K/2160p in the filename, but can't work out the syntax to do this, currently I'm using this portion:
"movieFormat={fn =~ /2160p/ ? '/4K' : 'Movies'}
Which moves if it matches 2160p to the directory /4k (under the main directory).
What is the conditional separator? How do I match either 2160p or 4K.
I've been googling this forum and also the groovy syntax, but can't find an example that matches.
I've trying to move files based on filenames, in this case 4K files. I want to match on 4K/2160p in the filename, but can't work out the syntax to do this, currently I'm using this portion:
"movieFormat={fn =~ /2160p/ ? '/4K' : 'Movies'}
Which moves if it matches 2160p to the directory /4k (under the main directory).
What is the conditional separator? How do I match either 2160p or 4K.
Re: Multiple pattern matches on filename
Thanks for the post! Before a real human comes by, please make sure your report has all the following points checked:
Please read How to Request Help and Fix Problems, Report Bugs, Get Features
- What are you trying to do achieve? What's not working? What have you tried so far?
- Include screenshots, logs or filenames (i.e. demonstrate the issue)
- Include basic information (i.e. sysinfo output)

Re: Multiple pattern matches on filename
You can use regular expressions to match multiple patterns.
Though, instead of checking the filename, I'd use mediainfo to check the video resolution:
Though, instead of checking the filename, I'd use mediainfo to check the video resolution:
Code: Select all
{dim[1] >= 2160 ? 'UHD' : 'HD'}
Re: Multiple pattern matches on filename
Thanks very much 

-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
i dont understand the answer, maybe can help me...
Folder for normal Movies = Folder1 (/volume1/video/Folder1)
Folder for 4k/UH Movies = Folder2 (/volume1/video/Folder1/Folder2)
can please help to find the right command for my usecase?
Code: Select all
filebot -script 'fn:amc' /volume1/Download --output '/volume1/video/Folder1' --action move -non-strict --lang de --def 'ut_label=movie' 'music=y' 'unsorted=y' 'artwork=y' 'skipExtract=y' 'deleteAfterExtract=y' 'movieFormat={file.parentFile.name}/{n} ({y})' --log WARNING --log-file '/volume1/Download/FileBotMovie.log'
Folder for 4k/UH Movies = Folder2 (/volume1/video/Folder1/Folder2)
can please help to find the right command for my usecase?
Re: Multiple pattern matches on filename
Code: Select all
{dim[1] >= 2160 ? 'UHD' : 'HD'}/{plex}
-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
thanks rednoah for fast answering, but i dont know where coming your paste in my command line...
filebot -script 'fn:amc' /volume1/Download --output '/volume1/video/Folder1' --action move -non-strict --lang de --def 'ut_label=movie' 'music=y' 'unsorted=y' 'artwork=y' 'skipExtract=y' 'deleteAfterExtract=y' 'movieFormat={dim[1] >= 2160 ? 'UHD' : 'HD'}/{plex}{file.parentFile.name}/{n} ({y})' --log WARNING --log-file '/volume1/Download/FileBotMovie.log'
is wrong?
filebot -script 'fn:amc' /volume1/Download --output '/volume1/video/Folder1' --action move -non-strict --lang de --def 'ut_label=movie' 'music=y' 'unsorted=y' 'artwork=y' 'skipExtract=y' 'deleteAfterExtract=y' 'movieFormat={dim[1] >= 2160 ? 'UHD' : 'HD'}/{plex}{file.parentFile.name}/{n} ({y})' --log WARNING --log-file '/volume1/Download/FileBotMovie.log'
is wrong?
Re: Multiple pattern matches on filename
I'm not quite sure how I should feel about 62 cent donations...PayPal wrote:Total amount:
€1,00 EUR
Fee amount:
-€0,38 EUR
Net amount:
€0,62 EUR

Here's a helpful link though: viewtopic.php?f=4&t=1899
-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
This is unfortunately as helpful as google.com 

Re: Multiple pattern matches on filename
google.com is considered to be very helpful.
Q: If you use '...' to mark the beginning and the end of the argument, what happens if ' occurs in the argument value?

Q: If you use '...' to mark the beginning and the end of the argument, what happens if ' occurs in the argument value?
-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
you mean Escape Arguments ?
Code: Select all
filebot -script 'fn:amc' /volume1/Download --output '/volume1/video/Folder1' --action move -non-strict --lang de --def 'ut_label=movie' 'music=y' 'unsorted=y' 'artwork=y' 'skipExtract=y' 'deleteAfterExtract=y' 'movieFormat={dim[1] >= 2160 ? \'Folder1/Folder2\' : \'Folder1\'}/{file.parentFile.name}/{n} ({y})' --log WARNING --log-file '/volume1/Download/FileBotMovie.log'
Re: Multiple pattern matches on filename
Do I look like a command interpreter? Just hit ENTER and then look at the output, then fix whatever it says, then rinse and repeat until it works.
-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
sh: -c: line 0: syntax error near unexpected token `('
Re: Multiple pattern matches on filename
It looks like you've been using FileBot Node. Why don't you keep using FileBot Node?
Use the format as is in the text box, and then learn from how FileBot Node correctly escapes your format:
PS: I don't have time for this kind step-by-step support. I recommend using the GUI. The CLI is for folks that don't mind figuring things out for themselves.
Use the format as is in the text box, and then learn from how FileBot Node correctly escapes your format:
Code: Select all
{dim[1] >= 2160 ? 'UHD' : 'HD'}/{plex}
-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
thanks for "very excellent support"
Re: Multiple pattern matches on filename
You got your 62 cent worth of support.
Besides, I provide excellent support for filebot, and not bash. If you can't be bothered to learn how to use the command-line, then you won't be able to use the command-line:
Besides, I provide excellent support for filebot, and not bash. If you can't be bothered to learn how to use the command-line, then you won't be able to use the command-line:
@see viewtopic.php?f=5&t=1868rednoah wrote:Make sure you escape and quote your cmdline arguments correctly. I will not fix your broken cmdline call for you.
-
- 402
- Posts: 18
- Joined: 07 Feb 2015, 12:15
Re: Multiple pattern matches on filename
if i use:
filebot can successfull starting, but the sorting/movie is totally wrong... i think the {dim[1] >= 2160 ? 'Folder1/Folder2' : 'Folder1'} is on wrong postion in command line... filebot node dont help, only support 1 working folder
Code: Select all
filebot -script 'fn:amc' /volume1/Download --output '/volume1/video/Folder1' --action move -non-strict --lang de --def 'ut_label=movie' 'music=y' 'unsorted=y' 'artwork=y' 'skipExtract=y' 'deleteAfterExtract=y' 'movieFormat={dim[1] >= 2160 ? 'Folder1/Folder2' : 'Folder1'}/{file.parentFile.name}/{n} ({y})' --log WARNING --log-file '/volume1/Download/FileBotMovie.log'