Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Demosthenes

macrumors newbie
Original poster
Mar 30, 2009
9
0
Hi All,

I could use a bit of help with this as I'm at a loss. Hope this is the right place.

I have a number of files all named accordingly:

032210.mp3
032210.mp4
032210.flv
032310.mp3
032310.mp4
032310.flv
etc.
I have a separate text file that is as follows:

MON 032210 3629
TUE 032310 3658
WED 032410 3616
THU 032510 3651
FRI 032610 3675
What I want to do is end up with:

032210-003629.mp3
032210-003629.mp4
032210-003629.flv
032310-003658.mp3
032310-003658.mp4
032310-003658.flv
etc.
I don't know how to do this, though I'm certain it can be done, and would rather learn how than do it all manually. If someone could just point me in the right direction or post the basics so that I could have a starting point I'd much appreciate it.

So far all I've managed to do is replace the ^M from the text file with \r so that cat works properly on it.

Thanks.
 

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
This isn't too uncommon. You could probably find a Perl script you could edit that would do the job.

The script would read the file.
Pase each line for that middle value.
Use the value to search for files in a folder that begin with that name.
Rename each file.
Loop back to parse the next line.

Type the following into Google;

perl script to read file and rename files
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.