match a number sequence from the folder name

Support for Windows users
Post Reply
Fiorelli
Posts: 9
Joined: 30 Oct 2020, 23:12

match a number sequence from the folder name

Post by Fiorelli »

Hi Rednoah,

I have a folder: f:/media/books/Michael Connelly - 01 - The Black Echo (1992) (which contains the book chapters).

I'd like to be able to extract the '01' from the folder name to use in a new folder name - via the GUI preset.

I know I can use the 'folder' attribute to return the entire filepath, but can't work out how to extract just the bit I want. fn.after appears to do what I want, but I can only apply it to the file name, not the folder name.

Many thanks.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Partial rename of folder

Post by rednoah »

You can do folder.name.match(/\d+/) to match a number sequence from the folder name.
:idea: Please read the FAQ and How to Request Help.
Fiorelli
Posts: 9
Joined: 30 Oct 2020, 23:12

Re: Partial rename of folder

Post by Fiorelli »

Champion, thanks.
Post Reply