Add .mp3 to the end of file names

15

5

I moved all my songs off my phone to a flash drive. Then I uploaded them to my new phone, only when they were stored to the flash drive they come over missing the ".mp3" so they are seen as "file". If I rename each file, adding the ".mp3" the file switches back to an audio file and plays just fine but there are 167 songs.

Is there a way to add the ".mp3" extension to all of them at once instead of one at a time?

I'm using my Windows 7 laptop to rename the songs on the flash drive. I selected all files names and right-clicked and hit rename. I entered the .mp3 and it rewrote every file to that one title, but it didn't add the .mp3. What should I do now?

jeff

Posted 2020-02-23T07:02:10.687

Reputation: 167

1How did you loose the mp3 extension ? My phone doesnt touch the file extension – eagle275 – 2020-02-24T13:00:23.643

1

May I recommend BulkRename. There's even a portable version.

– stackzebra – 2020-02-25T11:42:57.577

@eagle275 I'm guessing it was an iPhone? Apple products famously don't care about file extensions, storing the file type in a hidden metafile instead, which can cause confusion when transferring files between some Apple and non-Apple OS's. – Darrel Hoffman – 2020-02-25T14:31:32.507

Answers

40

I often use a command in Command Prompt in Windows, it's REN. The purpose is to rename a file or more.

ren oldfile.png newfile.png

But in this case, you need to rename multiple files, then we can make the command like this:

ren * *.mp3

In that, the first * is to declare all files and the second is to change all files to .mp3

Make sure you move all files to a folder and run the command in this folder.

Kaplan Kim

Posted 2020-02-23T07:02:10.687

Reputation: 557

5To be specific, this will append .mp3 to all files in the current directory ONLY (not subdirectories) – hLk – 2020-02-24T02:40:19.550

4Same answer has been given by phuclv few hours earlier – Daniel W. – 2020-02-24T21:21:36.963

@DanielW. It does boil down to the same answer but this answer provides more relevant details, especially for beginners who must wield the potentially daunting cmd tool. The simple example is also IMO helpful for noobs to understand what is going on. – glenneroo – 2020-02-25T19:47:11.397

But a noob is going to have a harder time finding cmd as opposed to PowerShell, which is now the default shell. – Keith Miller – 2020-02-26T19:29:36.183

31

Just run ren * *.mp3 in cmd. You don't need 3rd party solutions in this case

phuclv

Posted 2020-02-23T07:02:10.687

Reputation: 14 930

2Funny how powerful a basic cmd command sometimes appears. I don't think you can do it in a similarly simple way in bash on Linux. Though you can install the rename utility (not from util-linux!) and do something similar. – Ruslan – 2020-02-23T17:22:19.287

4@Ruslan Not quite as simple, but for file in *; do mv "$file" "$file".mp3; done should work. – pizzapants184 – 2020-02-23T21:32:16.617

@pizzapants184 yeah, that's straightforward, but far from being as laconic as the cmd example. – Ruslan – 2020-02-23T21:46:44.813

1@WGroleau if you mean Kaplan Kim's answer, it was written two hours later, not earlier. – Ruslan – 2020-02-23T21:48:06.387

Maybe a bug in the IOS app. When I looked, it was labeled nine hours and yours was labeled seven. Hmmm. – WGroleau – 2020-02-23T22:33:11.150

@Ruslan the ren command is from MSDOS command shell COMMAND.COM, and while it is a built-in command, in a lot of ways it's more like rename under bourne shell (e.g. bash under linux). The * wild card was never actually a wildcard in COMMAND (nor is it under cmd shell) each utility has to 'interpret it internally' so it's because cmd is less powerful that ren is able to just get away with it :P – Ahmed Masud – 2020-02-24T15:46:05.473

@AhmedMasud It's just a different philosophy. Unix-y shells usually expand wildcards, DOS/Windows doesn't. This makes Unix-y utilities simpler and usually more composable ("lots of small extremely simple utils"), but individually less powerful and more confusing (enjoy using * in a folder with files named something like -a or -rf :D). I always preferred having each application decide how to handle wildcards and I don't see wildcard expansion as particularly useful - it's more a dangerous misfeature :) – Luaan – 2020-02-25T08:36:43.670

13

LOL. so you have a bunch of numbered extensionless music files? Well, we can get the extension fixed so you can play the files. Also, once they're recognized as .mp3 files, they most likely will be metadata that can help restore meaningful names. But first things first.

This can be done with a few lines of PowerShell. If you'll please edit you question to provide paths & example names, as well as clarify if all the files are in one folder or a folder with subfolders. Are the extensionless .mp3 files mixed in with other file types?

For the time being, I'll assume the easiest, all files need the extension added & are in a single folder or its subfolders. The code is simply:

( Get-ChildItem 'c:\Music\Folder' -File -Recurse ) |
    Rename-Item -NewName { '{0}.mp3' -f $_.Name }

and for those that value brevity:

gci | ren -N {"$_.mp3"}

and that's it! Your files should be renamed.

Keith Miller

Posted 2020-02-23T07:02:10.687

Reputation: 1 789

4how is this easier than simple ren command? – eis – 2020-02-23T17:19:31.697

4@eis I also thought of writing this comment, but then noticed the -Recurse flag, which isn't easy to do with ren. – Ruslan – 2020-02-23T17:23:17.337

1@Ruslan well, OP wrote " I selected all files names and right-clicked and hit rename" so I think they probably are in the same folder – eis – 2020-02-23T17:39:11.553

9@eis my point is that this answer, being more general, might be useful for other users that need recursive processing. – Ruslan – 2020-02-23T17:40:10.103

2Tahnk you, Russian. I could have posted the shortest, situation-specific code: gci | ren {$_.mp3}, but if I was only concerned with the OP, I woulndn't bother. The code I posted (in additon to solving the problem-at-hand) gives simple examples of 1) recursion, 2) use of a acriptblock as a parameter, and 3) the -f format operaotr. The NewName can be constructed from anythign -- metadata, hashtable lookup, random-number generator. Use of full cmdlet names means easier internet seraches for the intellectually curious -- "we'll talk about aliases in the next chapter." :D – Keith Miller – 2020-02-23T19:36:30.310

2Furthermore, PowerShell is now the default shell in WIndows 10, finding cmd is a challenge for some (yes, I know the OP is on Win7). While I have great respect for experienced batch programmers, I cringe when I see someone trying to learn batch at this point. I was a whiz with Assembler on the 8086 processor back in the day, but I accept the fact that its time has passed. The only valid reason for learing cmd/batch today ia maintaining legacy systems. Even then, any worthy pro would be updating that code! – Keith Miller – 2020-02-23T19:51:42.490

6

Ex Falso free open source audio tag editor for Windows/Mac/Linux can do exactly what you want. Ex Falso automatically identifies all mp3 files as mp3 whether they have an .mp3 extension or not. Just select all the songs in Ex Falso, select the Rename Files tab, click the Preview button to preview the results of the batch rename operation, and click the Save button to batch rename them.

Ex Falso is a GUI application, so you can browse to the files to be renamed and batch rename them wherever they are located. You don't need to move all the files into the same folder.

Ex Falso can also edit song metadata tags in several different ways.

  1. Delete all song metadata tags.

  2. Batch edit song metadata tags.

  3. Automatically generate the tags from the path (for example song titles).

  4. Automatically rename songs from their tags.

  5. Automatically add numbers to songs' names from their track number tags.

karel

Posted 2020-02-23T07:02:10.687

Reputation: 11 374

1If the tracks are properly tagged, this is a great option. I used to do this on a regular basis after correcting tags on my music to have consistent filenames. – JPhi1618 – 2020-02-24T20:13:18.823

1

PowerToys is an official tool from Microsoft, that includes the PowerRename tool. It has a clear GUI, which makes it easier to use (but harder to automate). It also has some options for supporting smarter logic and will list any changes, so that you know what will happen in advance.

In your case you should perform the following steps after installing PowerRename:

  • Select all files
  • Right click a file and select PowerRename
  • Define the renaming pattern.
    • (Make sure to select Use Regular Expressions)
    • $ means end of sentence
    • We replace this ending with .mp3
  • Visually inspect the output and select Rename

enter image description here

Do note that it only works on more recent versions of Windows 10.

Ivo Merchiers

Posted 2020-02-23T07:02:10.687

Reputation: 111

This won't work with windows 7 (or 8, or even 10 if it's too old). – Gerald Schneider – 2020-02-25T09:05:51.780

@GeraldSchneider good point, I missed that from OP's post and I've added it to my post – Ivo Merchiers – 2020-02-25T11:02:23.983

1

Have you tried Command Prompt?

  1. Open up desired folder in windows Explorer.
  2. Select address bar and with it selected type "cmd" and press Enter. It will open up a Command Prompt in folder's path.
  3. Paste the following command in the Command Prompt: for /f %i in ('dir /b') do move "%i" "%i.mp3" and press Enter.

Enjoy.

mjoao

Posted 2020-02-23T07:02:10.687

Reputation: 21

1

Best tool for that is Total Commander. It has batch rename tool with batch extension edit feature + preview.

Multi-Rename Tool

Zakir

Posted 2020-02-23T07:02:10.687

Reputation: 111

+1. Also you could do the same with Double Commander, an open source total commander alternative – Sanya_Zol – 2020-02-25T22:15:15.967

0

If selecting all then renaming them with the .mp3 suffix didn't work, it may be that you have the Hide extensions for known file types option ticked.

You can find this option in File Explorer under File > Change folder and search options
Shown here

Once in Folder Options, click the View tab, under Advanced settings untick Hide extensions for known file types
Shown here

You should then be able to select all files and add .mp3 to the end.

Milo

Posted 2020-02-23T07:02:10.687

Reputation: 11