I convert my music with a program that for some reason decided to add some random junk to the end of the file name when it spits it out. The format for every single file name is like this: Name Of Song (dc9351243).mp3
I want to write a script that will go through a directory of music files and systematically rename every file without the last 12 characters, so in my example, it would just be Name Of Song.mp3. I figure there is a simple way to do this. I know MATLAB, some batch, and am learning C. I might be able to write a script in MATLAB to do it, but I would optimally want a batch script that I could place in the correct directory and execute, renaming all the files. Like I said, I am only slightly familiar with batch programming, can anyone give me a script to do this, or at least point me in the right direction? Thanks.
script for renaming files
Started by aloishis89, Feb 01 2009 09:32 PM
2 replies to this topic
#1
Posted 01 February 2009 - 09:32 PM
|
|
|
#2
Guest_Jordan_*
Posted 02 February 2009 - 06:13 AM
Guest_Jordan_*
You can do this using batch. You would need to take a substr (substring) of the string for the entire length - 12. I don't know the batch commands to do this but in PHP it would look like this:
$filename = substr($file,0,strlen($file)-12);
#3
Posted 02 February 2009 - 05:12 PM
Ha, well it turns out that as I was reading my RSS feeds, I came across this.
Its a program called D-FileMU (odd name) that does exactly what I need and more. There is a good write up on it at makeuseof.com. If I have time, I would still like to try to write my own, but for the time being, I'll just use this. Thanks for the help though.
Its a program called D-FileMU (odd name) that does exactly what I need and more. There is a good write up on it at makeuseof.com. If I have time, I would still like to try to write my own, but for the time being, I'll just use this. Thanks for the help though.


Sign In
Create Account


Back to top









