Extract filenames with 3 names from 2 names or viceversa

A swapping-ground for Regular Expression syntax

Extract filenames with 3 names from 2 names or viceversa

Postby melsoft » Sun Jan 05, 2020 9:02 am

Hello there,

I have a lot of books in a directory with names like this:

Benford, Gregory - Poveste de razboi.epub
Adrevon, Jean-Pierre - Jerod si pisica.doc

all together...i want to select only filenames with 2 names on authors from filenames with 3 names in authors name.

Is there a possibility to do this using bulk rename tool?
melsoft
 
Posts: 5
Joined: Tue Oct 17, 2017 6:45 pm

Re: Extract filenames with 3 names from 2 names or viceversa

Postby therube » Sun Jan 05, 2020 1:52 pm

Maybe this ?
Code: Select all
^.+,\s\w.+\s-\s\w.+\s\w.+\s*

12:Filters -> Mask (above), RegEx (enable)


(I didn't actually test in BRU, but in Everything, with:
regex:^.+,\s\w.+\s-\s\w.+\s\w.+\s*)


Actually, that might not be what you're wanting, not sure?
The way I wrote it, I'm greedy with the comma & accepting of two (or more) words after the - (dash).
therube
 
Posts: 889
Joined: Mon Jan 18, 2016 6:23 pm

Re: Extract filenames with 3 names from 2 names or viceversa

Postby melsoft » Sun Jan 05, 2020 4:16 pm

therube wrote:Maybe this ?
Code: Select all
^.+,\s\w.+\s-\s\w.+\s\w.+\s*

12:Filters -> Mask (above), RegEx (enable)


(I didn't actually test in BRU, but in Everything, with:
regex:^.+,\s\w.+\s-\s\w.+\s\w.+\s*)


Actually, that might not be what you're wanting, not sure?
The way I wrote it, I'm greedy with the comma & accepting of two (or more) words after the - (dash).



Not working...

I want to select all files with 2 names on authors name and move from there to a "test" named directory, leaving all files with authors 3 names or more unmoved...

Benford, Gregory - Poveste de razboi.epub
Adrevon, Jean-Pierre - Jerod si pisica.doc

I put in italic red color the file selected...
melsoft
 
Posts: 5
Joined: Tue Oct 17, 2017 6:45 pm

Re: Extract filenames with 3 names from 2 names or viceversa

Postby melsoft » Sun Jan 05, 2020 4:18 pm

PS: I can remove all the "quotes" sign from filenames...

Benford Gregory - Poveste de razboi.epub
Adrevon Jean-Pierre - Jerod si pisica.doc
melsoft
 
Posts: 5
Joined: Tue Oct 17, 2017 6:45 pm

Re: Extract filenames with 3 names from 2 names or viceversa

Postby bru » Wed Feb 19, 2020 5:03 am

RenamingOptions / Advanced / AllowUsing\ToCreateNewFolders

#1Regex Match/Replace:
^([A-Z][^ -,]*, [A-Z][^-]* - .*)$
NewFolderName\\1

You can either use pre-existing FolderNames or create them with a NewFolderName.
Cheers.
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm

Re: Extract filenames with 3 names from 2 names or viceversa

Postby bru » Wed Feb 19, 2020 5:28 am

Sorry, I wasnt clear in my original post, it moves the 2Name-authors only.
For the record, with RenamingOptions / Advanced / AllowUsing\ToCreateNewFolders:

#1Regex Match/Replace:
^([A-Z][^ -,]*, [A-Z][^-]* - .*)$
FolderFor2NameAuthors\\1

#1Regex Match/Replace:
^([A-Z][^ -,]*, [A-Z][^-]*-[A-Z][^-]* - .*)$
FolderFor3NameAuthors\\1

Both cases depend on Space-Space as the Artist/Title separator.
Cheers.
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm


Return to Regular Expressions