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

All about user-defined episode / movie / file name format expressions
Post Reply
hama4reall
Posts: 23
Joined: 13 May 2023, 12:21

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

Post 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?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [SNIPPET] Match information from the file path

Post 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 }
:idea: Please read the FAQ and How to Request Help.
hama4reall
Posts: 23
Joined: 13 May 2023, 12:21

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

Post 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.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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
:idea: Please read the FAQ and How to Request Help.
hama4reall
Posts: 23
Joined: 13 May 2023, 12:21

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

Post by hama4reall »

got it. thanks again!
Post Reply