RadioGeorge
asked on
How Can I Rename mp3 files easily-special situation
This is round 2 for a question I've asked earlier, but this time with a better example and clearer explanation of what is needed.
The object is to find a fast and easy way to reformat the names of mp3 files. PLEASE NOTE that I am not a code writer, so any responses about me writing code will be worthless.
Let's say I have this list of files:
TaxHelp.mp3
WeightLoss.mp3
HealthMarkets.mp3
LasikVision.mp3
LifeInsurance.mp3
SandalsResorts.mp3
I need to change their names to:
1.1-Spot1.mp3
1.2-Spot2.mp3
2.1-Spot1.mp3
2.2-Spot2.mp3
3.1-Spot1.mp3
3.2-Spot2.mp3
So, the first thing I need is some simple way to do this quickly and easily. If the solution is a piece of software, please make sure you have run this project through the software yourself and not just looked it over.
Now, the second thing I need is for the solution to be flexible enough so that a week later (and each week after that), the same re-naming can be done quickly and easily--BUT with the file names In different order.
Example:
Week One Files Renamed As
TaxHelp.mp3 1.1-Spot1.mp3
WeightLoss.mp3 1.2-Spot1.mp3
HealthMarkets.mp3 2.1-Spot1.mp3
LasikVision.mp3 2.2-Spot1.mp3
LifeInsurance.mp3 3.1-Spot1.mp3
SandalsResorts.mp3 3.2-Spot1.mp3
Week Two Files Renamed As
LifeInsurance.mp3 1.1-Spot1.mp3
WeightLoss.mp3 1.2-Spot2.mp3
LasikVision.mp3 2.1-Spot1.mp3
HealthMarkets.mp3 2.2-Spot2.mp3
SandalsResorts.mp3 3.1-Spot1.mp3
TaxHelp.mp3 3.2-Spot2.mp3
I need to do this weekly for about 50-60 different files, and really need to find a way to get the reaming done faster than doing it individually, even by using a simple macro, which still requires file-by-file work rather than getting it done for all the files in one batch quickly.
Suggestions/solutions?
The object is to find a fast and easy way to reformat the names of mp3 files. PLEASE NOTE that I am not a code writer, so any responses about me writing code will be worthless.
Let's say I have this list of files:
TaxHelp.mp3
WeightLoss.mp3
HealthMarkets.mp3
LasikVision.mp3
LifeInsurance.mp3
SandalsResorts.mp3
I need to change their names to:
1.1-Spot1.mp3
1.2-Spot2.mp3
2.1-Spot1.mp3
2.2-Spot2.mp3
3.1-Spot1.mp3
3.2-Spot2.mp3
So, the first thing I need is some simple way to do this quickly and easily. If the solution is a piece of software, please make sure you have run this project through the software yourself and not just looked it over.
Now, the second thing I need is for the solution to be flexible enough so that a week later (and each week after that), the same re-naming can be done quickly and easily--BUT with the file names In different order.
Example:
Week One Files Renamed As
TaxHelp.mp3 1.1-Spot1.mp3
WeightLoss.mp3 1.2-Spot1.mp3
HealthMarkets.mp3 2.1-Spot1.mp3
LasikVision.mp3 2.2-Spot1.mp3
LifeInsurance.mp3 3.1-Spot1.mp3
SandalsResorts.mp3 3.2-Spot1.mp3
Week Two Files Renamed As
LifeInsurance.mp3 1.1-Spot1.mp3
WeightLoss.mp3 1.2-Spot2.mp3
LasikVision.mp3 2.1-Spot1.mp3
HealthMarkets.mp3 2.2-Spot2.mp3
SandalsResorts.mp3 3.1-Spot1.mp3
TaxHelp.mp3 3.2-Spot2.mp3
I need to do this weekly for about 50-60 different files, and really need to find a way to get the reaming done faster than doing it individually, even by using a simple macro, which still requires file-by-file work rather than getting it done for all the files in one batch quickly.
Suggestions/solutions?
Here is a simple batch script that will change all the *.mp3 files to the format you specified:
set /a a=1
set /a b=1
setlocal ENABLEDELAYEDEXPANSION
for /f "tokens=*" %%f in ('dir /b *.mp3') do (
ren %%f !a!.!b!-Spot!b!.mp3
if "!b!" EQU "1" (
set /a b=2
) else (
set /a a+=1
set /a b=1
)
)
See if that will work for you.
ASKER
on the road and will check the script later in the day. To answer your questions:
--running on Windows 10 and would also hope that it will run on Windows 7 and/or XP. I use backup computers (XP offline, of course) from time to time but 10 is the main one.
The renaming of the files: these are in fact commercials and the sequence is shuffled depending on:
--cancellations of expired ones
--new ones being added to the lineup
--requests for heavier exposure for some for short periods of time
--personal judgment as to whether or not some need to be run in ceratin hours more heavily than other hours
So this is a situation that is handled individually every week. It is easy to simply make the hourly lists, but not so easy when you have to rename them all with the numbering system, which is used by the players that play the mp3 files.
--running on Windows 10 and would also hope that it will run on Windows 7 and/or XP. I use backup computers (XP offline, of course) from time to time but 10 is the main one.
The renaming of the files: these are in fact commercials and the sequence is shuffled depending on:
--cancellations of expired ones
--new ones being added to the lineup
--requests for heavier exposure for some for short periods of time
--personal judgment as to whether or not some need to be run in ceratin hours more heavily than other hours
So this is a situation that is handled individually every week. It is easy to simply make the hourly lists, but not so easy when you have to rename them all with the numbering system, which is used by the players that play the mp3 files.
So if the numbering is needs to be defined by someone, then we need a way to get that information into the routine. You could have someone write and interface but I think that would be overkill. I am guessing that because we are looking for a way to automate this renaming that you don't expect them for whatever reason to rename them to your naming convention. Would it be possible to have the person who chooses the order of the spots to at least rename them with a leading number? For example:
Week One Files Renamed As
------------------------- -------------------------- -
TaxHelp.mp3 1-TaxHelp.mp3
WeightLoss.mp3 2-WeightLoss.mp3
HealthMarkets.mp3 3-HealthMarkets.mp3
LasikVision.mp3 4-LasikVision.mp3
LifeInsurance.mp3 5-LifeInsurance.mp3
SandalsResorts.mp3 6-SandalsResorts.mp3
This way the files would be sorted correctly and then could be renamed by the script correctly.
If we need a way for someone to input the numbers for the files as the script is running, that will require a different script.
Week One Files Renamed As
------------------------- --------------------------
TaxHelp.mp3 1-TaxHelp.mp3
WeightLoss.mp3 2-WeightLoss.mp3
HealthMarkets.mp3 3-HealthMarkets.mp3
LasikVision.mp3 4-LasikVision.mp3
LifeInsurance.mp3 5-LifeInsurance.mp3
SandalsResorts.mp3 6-SandalsResorts.mp3
This way the files would be sorted correctly and then could be renamed by the script correctly.
If we need a way for someone to input the numbers for the files as the script is running, that will require a different script.
This is an example of a script that asks for input to rename each file.
@echo off
setlocal EnableDelayedExpansion
echo Please enter the number of the break and the
echo order in the break for the following spots:
for /f "tokens=*" %%f in ('dir /b *.mp3') do (
echo -- Break and play order for %%f
set /p a="Which break? "
set /p b="Play order? "
ren %%f !a!.!b!-Spot!b!.mp3
)
By the way, I did test these sample scripts in Win10 and they work.
ASKER
Austin, first, thanks for the time and effort you are putting into this question.
The numbering convention I used in my example,
1.1-Spot1.mp3
1.2-Spot2.mp3
2.1-Spot1.mp3
2.2-Spot2.mp3
3.1-Spot1.mp3
3.2-Spot2.mp3
is that way for a specific reason: the player that plays the mp3 files was modified to play files in sequential order. So what we have is show segments and commercial ("spot") segments in an overall file that looks like this:
1-Austin Show Segment 1.mp3
1.1-Spot1.mp3
1.2-Spot2.mp3
2-Austin Show Segment 2.mp3
2.1-Spot1.mp3
2.2-Spot2.mp3
3-Austin Show Segment 3.mp3
3.1-Spot1.mp3
3.2-Spot2.mp3
and so up for a total of show segments ranging from 7 to 12 for various shows.
FYI, the show segments do not come neatly numbered, of course, but using Free Commander software, it is super fast and simple to change the segment names as shown in the example here with just a couple of clicks, once you have set up the naming format. I have tried to do the same thing for the spot files, but it sure looks like Free Commander can't do that because of the odd and non-perfectly-consecutive numbering the spots use.
The numbering convention I used in my example,
1.1-Spot1.mp3
1.2-Spot2.mp3
2.1-Spot1.mp3
2.2-Spot2.mp3
3.1-Spot1.mp3
3.2-Spot2.mp3
is that way for a specific reason: the player that plays the mp3 files was modified to play files in sequential order. So what we have is show segments and commercial ("spot") segments in an overall file that looks like this:
1-Austin Show Segment 1.mp3
1.1-Spot1.mp3
1.2-Spot2.mp3
2-Austin Show Segment 2.mp3
2.1-Spot1.mp3
2.2-Spot2.mp3
3-Austin Show Segment 3.mp3
3.1-Spot1.mp3
3.2-Spot2.mp3
and so up for a total of show segments ranging from 7 to 12 for various shows.
FYI, the show segments do not come neatly numbered, of course, but using Free Commander software, it is super fast and simple to change the segment names as shown in the example here with just a couple of clicks, once you have set up the naming format. I have tried to do the same thing for the spot files, but it sure looks like Free Commander can't do that because of the odd and non-perfectly-consecutive numbering the spots use.
I imagined something like what you described was the case.
So you now have two scripts that will give you two options of how to proceed. Let me know if you are now good to go!
So you now have two scripts that will give you two options of how to proceed. Let me know if you are now good to go!
ASKER
Austin, this may sound like a dumb question, but I have to ask: what program do I use to run those scripts you sent? I am simply not familiar with running scripts like this, so I need some very basic information. Can't start the car unless you know where to put the key!
1. open notepad and paste the script in.
2. save it somewhere with whatever name you prefer but with the extension .bat
3. stick that file in the directory that you are going to do some renaming.
4. double-click on it.
That should do it. Hit f5 when you are looking at the directory to refresh if the files do not appear to have changed.
Let me know if you have any other questions.
2. save it somewhere with whatever name you prefer but with the extension .bat
3. stick that file in the directory that you are going to do some renaming.
4. double-click on it.
That should do it. Hit f5 when you are looking at the directory to refresh if the files do not appear to have changed.
Let me know if you have any other questions.
ASKER
Austin, tried the second one as per your instructions today and it seemed to work just fine. I will do it again tomorrow and test the first one and then report back and wrap it up. Naturally, you'll get all the points for your great help. Wonder if this will lead me to come up with some more things to hit you up with??
Remember, those scripts do different things. The first renames them all in a single sweep by whatever alphanumeric order they fall into, while the second is interactive. I recommend testing them with files that you have backup copies of.
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, the wonders of code testing! Austin, you fixed the spaces-between-names problem perfectly. Both scripts work 100% as they should. The second one is the one that will likely get used the most. A real timesaver. You are most definitely DA MAN. Thank you, Thank You, Thank You.
I'm glad I could help. Please don't forget to mark whose answer helped you so that we get our points. I have had an account here for a long time but have just become active this month so I have a lot of catching up to do get my points to a respectable level.
Also, if you or anyone you know needs any work for hire done, let me know! I am currently between jobs and looking for work.
Thanks!
Also, if you or anyone you know needs any work for hire done, let me know! I am currently between jobs and looking for work.
Thanks!
I just now see that you accepted my solution! Thanks for the points!
But the biggest question I have is, how are you determining which file to rename to which new name. What I mean is, are you just renaming files indiscriminately or is there some logic behind why TaxHelp.mp3 and WeightLoss.mp3 should be spots 1.1 and 1.2 while HealthMarkets.mp3 and LasikVision.mp3 become spots 2.1 and 2.2? In the example, files are not in alphanumerical order, so should I assume that you will need a way to define which files get renamed to what?
Thanks for any additional explanation you can provide.