Need a bit of help with a batch file rename...regex maybe?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Need a bit of help with a batch file rename...regex maybe?

Post by j_c_hallgren »

Got a number of music files that are presently named in the format:
nnnn - 99 - xxxxxxxxxxxxxxxxxx.mp3
where nnnn is four char (no more, no less) clue to album name
and 99 is track nbr
and xxxxxxxxxx is track name of varying length

Desired output format is reversed somewhat:
xxxxxxxxxxxxxxx - nnnn - 99.mp3

Can this be accomplished with XY? Without a lot of manual effort?
Thanks!

(I'm trying to locate similar but not exact same track names on various albums)
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

Yeah regexp can do this, I think this one shoud do it:

Code: Select all

(.{4}) - ([0-9]+) - (.+)\.(.+)>$3 - $1 - $2.$4
Proud XYplorer Fanatic

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

:D Worked like a charm! THANKS!! 8)

Maybe you'd add this to wiki as another example??

And the speed of your reply was much appreciated!
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

Glad I could help 8)

Regarding the wiki, yeah I was actually thinking maybe on the RegExp page itself a section full of various examples, of both "selecting" regexp (for VF, etc) and "replacing" VF (for rename operations) could be a nice thing to add, since many would like it it seems.

So if you guys have regexp's to add, go ahead! ;)
Proud XYplorer Fanatic

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

Jacky, I'd suggest: take above example and make a sample entry on wiki of how you'd prefer it look...then others can add in similar format...
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

j_c_hallgren wrote:Jacky, I'd suggest: take above example and make a sample entry on wiki of how you'd prefer it look...then others can add in similar format...
And, I have said it before somewhere: I have no big idea of regexp myself but if someone would provide me a comprehensive list of good regexp examples, I will add a "Hints" button right on the RegExp Rename dialog.

John Bee
Posts: 323
Joined: 01 May 2005 20:21
Location: Canada

Post by John Bee »

admin wrote:... a comprehensive list of good regexp examples, I will add a "Hints" button right on the RegExp Rename dialog.
This "Hints" button I like. Want to see it everywhere. For the people like me, who can't remember from one moment to the next.

Can always use a hint, especially when dealing with the strange but powerfull RegExp.

Even looking at the example above by Jacky, it took me awhile to figure it out. (having the before and after helps)

John (what was I talking about again? :lol: )

Post Reply