Auto Renaming of filenames if duplicated

Hi !

How do I make Mp3 tag to add a number at the end of the FILENAME in the case of duplicated filenames?

Example: ABBA-Mamma Mia.mp3 - first copy of the song

               ABBA-Mamma Mia(2).mp3            -    second copy of the song

Thanks in advance !!!

This is currently not possible.

Personally my filenames are artist\album - year\track - title

with my current tag -> filename, I much prefer mp3tag to stay this way - esp when other half downloaded the same album twice before I started my re-org

Yes, sadly, that is true.
BUT: Rename all your files (with tag - filename function) and add a string that can be used as a criterion for filtering e.g. xxxx
the filename would look like this:

%track% - %title% - xxxx.mp3
Start the renaming and whenever a duplicate would be the consequence, MP3tag stops renaming and leaves the filename as it is.
After the renaming you filter for all filenames that do not contain the "- xxxx" - and there they are, your duplicates.
If necessary you may now rename them to the "(2)" at the end with a similiar method:
%track% - %title% (2)

and then rename all non-duplicates to the original filename.
All this requires that the tag entries are identical. You will have to do a fair bit of unification and standardization before you find the duplicates using the filename.

How would I be able to setup a filter to show both versions of the duplicate files?

You could create a filter expression to show "this filename format" OR "that filename format".

See also:
Tag -> Dateiname (Wenn Doppelt Dann einen Buchstaben vorsetzen) - wie?
(hoping that Google translation can help to understand).


I understand using an OR filter but how do I limit the displayed tracks to only albums with duplicates?
The syntax of the filter is escaping me right now.
"Filename with the tag" OR "Filename without the tag" shows all the files.

Google translate didn't really help.

Note; The two Feet of snow we just got, over night, may have adversely effected my brain.

A completely new approach:

Step 1: Save Path and Tracknumber to restore your filestructure later
Action: Format Value
Field: TEMP
Formatstring: %_path%|%track%

Step 2: Bring your whole collection to a new arrangement just for being able to use the "reset counter for each directory" function of the Autonumbering Wizard later
Action: Format Value
Formatstring: C:\temp music\%artist% - %title%\%_counter%

Step 3: Give new tracknumbers
Autonumbering Wizard
Save total count of tracks: YES
Leading zeros for tracknumber: NO
Reset counter for each directory: YES

Step 4: Show all duplicates
Filter: NOT %track% MATCHES /1

Now you see all versions of duplicates and you can do whatever you want to do with them.

Step 5: Restore your old file structure
Action: Guess Values
Sourceformat: %temp%
Formatstring: %_path%|%track%

Step 6: Delete C:\temp music, which should now only have empty folders in it, with the Windows Explorer.

This only works when you have your complete collection on one harddrive (if you don't want to move lots of track physically which will take some time and is also a question of harddrive size). Of course you can replace C:\temp music by whatever suits you and you should choose the letter of the hardrive of you collection.

This does not work with mp4 and m4a files since with these files, %track% can't take the number ot total tracks.

I'd rather create a playlist with all duplicate tracks.
Use File > Export (Ctrl+E) and create a new config with this text.

$loop($lower(%artist% %title%))$loop($lower(%artist% %title%))$loopend()$ifgreater(%_max_counter%,1,'#Same Artist Title: '$if2(%artist% -- %title%,-- empty --)
$loop($lower(%artist% %title%))%_path%
QUOTE (dano @ Feb 2 2011, 18:40) <{POST_SNAPBACK}>
I'd rather create a playlist with all duplicate tracks.

Use File > Export (Ctrl+E) and create a new config with this text.

$loop($lower(%artist% %title%))$loop($lower(%artist% %title%))$loopend()$ifgreater(%_max_counter%,1,'#Same Artist Title: '$if2(%artist% -- %title%,-- empty --)
$loop($lower(%artist% %title%))%_path%

Much better I admit.

2017... can we have this feature added?

You can add it yourself.
When renaming files, add %_counter% at the end (or at the front or in the middle) of the naming pattern.
This should get you a unique filename.
All other reasoning has been laid out in the previous posts.

I am renaming a single folder that contains a large number of files; once I batch apply all mp3tag filters, some files will eventually be renamed (_FILENAME) the same way , for instance:

"Inxs - kick (128kbps)"
"9 - Inxs - kick"

Based on my rules/filters, both
would technically be renamed " INXS - Kick"

however, when MP3 tag reaches the second instance, it will pop a window that says it can't rename the file because it already exists and offer to abort, retry or ignore, which is fine, I understand the rationale.
However, is there any technical reason for not offering, like numerous applications do, an option to keep the new instance and append a counter, IE : INXS - Kick (2) ?

otherwise even if go through all of the "ignore" process, I still have files that are not alphabetically sortable in a way that I'll be able to identify properly (one will start with "I" and the other one with "9")

I've read the forums and all the options, including adding a %_counter% and so on but this simple option would make things much simpler and avoid having to rename all files etc. etc. and go through hoops to do something that is quite common for most apps, including windows itself.

Also adding an option to "automatically apply" would be good as I'm currently using an AutoIT script to automate clicking on the ignore button... otherwise most people will have to stay there and wait for the next click until the job is done....

Just my 2cents, Let me know if I am missing something obvious.

Yes, this function does not exist.
But I don't get the rest of it.
What I understood: I think of a naming scheme to get everything nicely unified.
I apply that naming scheme but then I get the message that this naming scheme does not lead to unique filenames.
The result is either that the filename stays as it is (current implementation) or it gets renamed to something different but also not matching the naming scheme. What would I have won?

For me the message would be an indicator that I have to revise my naming scheme - probably I have to add more information and just ARTIST and TITLE is not enough.
In any way, the basic goal to get nicely unified names cannot be reached with this naming scheme.
To sum it up for me: Where would be the benefit?
(And perhaps this small benefit plus an existing workaround put this feature not on top of the list. Just guessing.)

The files should be sortable in MP3tag - esp. if you create the filename from tags as then you can sort by the fields. And with "kick" in TITLE, both files should appear close to each other.

Thanks for the feedback, adding further details for clarity:

To take my example above, your statement would be true if I wanted to keep both files, which is not the case; once the naming scheme is applied, I'll simply get rid of one of the 2 files.

For my use case, the first option doesn't work and the second is perfectly fine and solves the issue;
Also, I don't see those 2 options competing with each other, the second one simply complements the first one, if desired/option chosen. Maybe I am missing something but I don't quite understand, especially if it's an option, how would that option interfere with the existing app structure? some user doesn't want it ? then just don't chose the option.

No, that's the whole problem; the files I am working with do not have any ID3 tag populated, I am working solely with the filename; once the naming scheme is applied, I get ARTIST - TITLE and populate the Tags accordingly.

In my example, the second file, which would be ignored in the current implementation would end up with 9 as the artist and Inxs as the title...
Alternatively, by adding a simple option to "keep both but rename" as in windows explorer, I wouldn't have to press ignore on all occurences, could easily spot files with same name (yes with a numbering at the end which is totally fine with me) and be a happy camper.

Just providing constructive feedback, this is a free app and it's the developpers prerogative to do whatever they want, I understand that. But based on some other much more complicated tasks I was able to accomplish with MP3tag, find it a bit disappointing that this simple task is not achievable.

fingers crossed for a future release, thx again for your feedback.

How do you get from



You would have to treat each pattern differently anyway - some with leading numbers, some with superfluous info in parenthesis, some with 2 parts, some with 3 parts - so it should be easy to get the info into the tag fields first and then construct a filename from that.
If the files get renamed automatically, you wouldn't notice that there was a problem - so after the import you would end up with something like
Artist: INXS
TITLE: Kick (2)
The point I am trying to make: there are so many alternatives already, there are so many ways to get the same work done without the feature to rename automatically why should any effort be spent on a feature that could easily be made obsolete with just a little adaptation of the workflow on the user side?
But you are right: I am not the one to define the way how the application develops, let's see how it turns out.
And until then you know by now how to achieve your goal with other means.

very easy with MP3tag, just add the appropriate actions and scripts;
this is already done and works perfectly;
Not sure how to copy all actions, let me know and I'll attach a copy.
but here's an example :
(\d{2,}\s*kbps) and replace with blank,

or ^\s*[0-9]+\s*-\s* to remove the track-number if followed by a dash

get rid of extra parentheses, etc. etc. etc.

isn't that the purpose of MP3tag?

Again that's my whole point: * I only have the filenames*;
without any tag fields populated, I have to "clean" filenames first so there is some logic in the way the filename is constructed, otherwise I am all ears on some other way for MP3tag to magically guess artists and titles when filenames are a mess to start with;

And to add to the first point above, It was not that hard to construct a naming scheme to accomplish it, I'm already done, it works perfectly. Proof is, same songs end up with the same name, which again wouldn't be a problem if when a duplicate result is encountered, mp3tag simply adds "(2)" or "(3)", etc., when the option is ticked.

if someone has an alternative that works and proves more efficient, please feel free to share I'm always open to learn.