Page 1 of 1

match a number sequence from the folder name

Posted: 31 Dec 2020, 04:49
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.

Re: Partial rename of folder

Posted: 31 Dec 2020, 05:14
by rednoah
You can do folder.name.match(/\d+/) to match a number sequence from the folder name.

Re: Partial rename of folder

Posted: 31 Dec 2020, 05:23
by Fiorelli
Champion, thanks.