Page 1 of 1

How do I match information from anywhere in the file path?

Posted: 24 Sep 2023, 12:40
by hama4reall
can we match from {f} like i want to match 'Badini' in this path using

Code: Select all

{f.match(/Badini/)}

Code: Select all

E:\files\CDN1\paxshkrdn2\Badini\A.Night.Of.Horror.Volume.1.2015.1080P.mp4
i tried it and it doesn't work apparently its because {f} isn't a string and match() only works on strings? if that so what can i do to match "Badini" in the file path and the filename itself?

Re: [SNIPPET] Match information from the file path

Posted: 24 Sep 2023, 13:01
by rednoah
e.g. match /Badini/ from the file path:

Format: Select all

{ f.path.match(/Badini/) }
e.g. use the parent folder name:

Format: Select all

{ folder.name }

Re: How do I match information from anywhere in the file path?

Posted: 24 Sep 2023, 16:19
by hama4reall
thanks! didn't know about that string. is there a page reference for all the strings? like https://www.filebot.net/naming.html but this page doesn't have em all.

Re: How do I match information from anywhere in the file path?

Posted: 24 Sep 2023, 17:10
by rednoah
:idea: {folder} is on the list. File::getName is Java API. There is no "all the strings" because you are writing code. Please read the FileBot Groovy Expression Reference Documentation for details.


:idea: The built-in Icon Bindings viewer will give you a list of commonly used snippets though, including folder.name and friends, so I recommend slowly scrolling through the list for inspiration:
Screenshot

Re: How do I match information from anywhere in the file path?

Posted: 24 Sep 2023, 17:17
by hama4reall
got it. thanks again!