Page 1 of 1

Batch Rename Patterns

Posted: 22 Aug 2014 06:59
by Jeff Bellune
Without resorting to RegExp or Scripts, are there pattern wildcards or placeholders that will let me manipulate characters in the middle of base file names, or delete characters anywhere in the file name? For example, I ripped some of my CDs a while back using the format 01-<track name>.flac, 02-<different track name>.flac, etc. For display, tagging and media server reasons I'd like to get rid of the hyphen between the two-digit track number and the track name and replace it with a space.

For other rips, sometimes the online database would add a disk number and I'd get 1.01-<song name>.flac. So in that case I need to delete the 1. as well as do the hyphen/space thing.

A third example is the database adding (Live) to every track name on a live album. Maybe it's handy if I'm doing a flat view search on a media server and I need to know if Back In Black is the live or studio version, but most of the time it's just annoying. I'd like to rename the files by deleting the (Live) suffix. Search and Replace seems like a good candidate for this one, but I haven't found a workable pattern yet.

Thanks,
Jeff

Re: Batch Rename Patterns

Posted: 22 Aug 2014 07:50
by highend
You can't do that with e.g. batch rename. The safest (and most flexible way) is the regexp way...

- Replaces only the first hyphen
01-<track name>.flac
to
01 <track name>.flac

Code: Select all

^(\d+)-(.*) > $1 $2
- Replaces any leading [0-9]. and the first hyphen
1.01-<song name>.flac
to
01 <song name>.flac

Code: Select all

^(\d\.)(\d+)-(.*) > $2 $3
- This could be done with search and replace but the regex version strips any unnecessary leading or trailing spaces as well
01 song name (Live).flac
to
01 song name.flac

Code: Select all

\s*\(live\)\s* > 

Re: Batch Rename Patterns

Posted: 22 Aug 2014 13:12
by Jeff Bellune
Hello highend,

Thank you for those expressions. They work great! I wanted to avoid getting into RegEx but I think I don't have much choice any more... :mrgreen:

Cheers,
Jeff

Re: Batch Rename Patterns

Posted: 22 Aug 2014 17:15
by Quaraxkad
Jeff Bellune wrote:Thank you for those expressions. They work great! I wanted to avoid getting into RegEx but I think I don't have much choice any more... :mrgreen:

If you rename a lot, RegExp will make your life MUCH easier!

Re: Batch Rename Patterns

Posted: 24 Aug 2014 09:58
by Stef123
Jeff Bellune wrote:I wanted to avoid getting into RegEx but I think I don't have much choice any more... :mrgreen:
Try RenameMaster http://www.joejoesoft.com/vcms/108/
It integrates nicely into XY (selected files are passed on) and manages your tasks without RegEx on the user interface. Try out the provided example scripts like EG-SwapAroundDash.rmscr and pare down the interface to what you really need.

Re: Batch Rename Patterns

Posted: 24 Aug 2014 17:11
by Jeff Bellune
^^^^

Thanks. It looks promising!

I suppose I'll find this out after installing it and nosing around a bit, but how do files in XY get passed to RenameMaster?

Cheers,
Jeff

Re: Batch Rename Patterns

Posted: 24 Aug 2014 19:16
by Stef123
Jeff Bellune wrote:I suppose I'll find this out after installing it and nosing around a bit, but how do files in XY get passed to RenameMaster?
I carry the portable version around with me, and the following UserDefinedCommand is triggered when I press F2:

Category: Open with
Application: ..\RenameMaster\RenameMaster.exe
Mode: Single Instance

I multi-select a bunch of files, then press F2, RenameMaster opens with the active-tab path, tick marks for all checkboxes enabled that correspond to my active selection in XY

Re: Batch Rename Patterns

Posted: 24 Aug 2014 20:47
by Jeff Bellune
Stef123 wrote: Category: Open with
Application: ..\RenameMaster\RenameMaster.exe
Mode: Single Instance

I multi-select a bunch of files, then press F2, RenameMaster opens with the active-tab path, tick marks for all checkboxes enabled that correspond to my active selection in XY
Thanks! I can't wait to try it. :)

Cheers,
Jeff

Re: Batch Rename Patterns

Posted: 20 Jan 2024 00:02
by m_l_oliver@yahoo.com
This is a somewhat helpful discussion, showing a limited variety of tokens being used.
It's frustrating that the knowledgeable discussion responders forgot to mention the help documents that more fully describe the tokens they use in their response.
This may seem like a minor point, but it seems fairly important to me since, after an hour of investigating, the XYplorer app itself is pointing me to help aids that offer little knowledge about the universe of regular expression tokens. Maybe I am (or the XYplorer app is) am overlooking something obvious.

Re: Batch Rename Patterns

Posted: 20 Jan 2024 00:07
by highend
RegExps aren't bound to XY, they exist far longer and in countless applications.

If you need guidance of what XY actually uses, google for: vbscript regular expressions

Re: Batch Rename Patterns

Posted: 21 Jan 2024 05:33
by m_l_oliver@yahoo.com
Your google suggestion is very helpful. :)
I wish the XYplorer help aids would have included that same advice. It would save some serious time for me and others. Including the 'vbscript' argument for google searching is great to know too since it helps the search focus in on the appropriate flavor of regular expressions. I would have missed the 'vbscript' term completely except for your helpful advice.
Much appreciated.

Re: Batch Rename Patterns

Posted: 21 Jan 2024 19:51
by admin
I'll add that to the Help, thanks! :tup: