Re: automatic file renaming?



__/ [ Kat ] on Sunday 14 May 2006 23:43 \__

Hello everyone on this newsgroup,
I'd like to know if it's possible to automatically rename a whole lot of
files (namely mp3 files), is there a console command that would take
care of it?

Here's an example of what I'm aiming at. I have lots of long file names
like this one:

01 - Artist Name - A Veeeeery Long Album Title - Song Title.mp3

I'd like to shorten them to:

01 - Song Title.mp3


Now don't tell me I have to rename 1429 mp3 files manually...
Any help appreciated! Thanks.


You'll need to parse filenames, choose a new name for them and then rename
them. You might be better off asking in the Perl newsgroup. If you dump all
file to some playlist, e.g. ~/playlist.txt which contains newline-sparated
filenames, then do something like

,----[ Code ]
| #!/usr/bin/perl -w
| open(IFP,"/home/YOU/playlist.txt") or die
| "could not open file: $!";
| $line=<IFP>;
| (undef,undef,$file)=split(/-/-$line);
|
| # some Perly file moving operation
|
| close(IFP);
`----

Perhaps this can serve as a rudimentary starting point.

Hope it helps,

Roy

--
Roy S. Schestowitz | "Oops. My brain just hit a bad sector"
http://Schestowitz.com | GNU is Not UNIX ¦ PGP-Key: 0x74572E8E
11:35am up 17 days 18:32, 8 users, load average: 0.59, 0.54, 0.52
http://iuron.com - proposing a non-profit search engine
.



Relevant Pages

  • Re: automatic file renaming?
    ... is there a console command that would take ... Now don't tell me I have to rename 1429 mp3 files manually... ... Save the script with your choice of name. ...
    (alt.os.linux.suse)
  • Re: Mp3 attachments received as Untitled.bin
    ... On the same computer I also have Outlook Express and if I use that to receive the mail the mp3 files are received correctly. ... I can also rename the untitled.bin files back to a mp3 file and the files work correctly. ... Open the messages properties and see what the MIME headers say. ...
    (microsoft.public.outlook)
  • Re: Moosic help please
    ... Don't know anything about MP3 files but I have ULead PhotoImpact and after ... I take it you have a prog that opens .mp3 files? ... I would have thought that being the case you could rename it in Windows ... You put your siggy in the middle ...
    (uk.people.silversurfers)
  • Where does Media Player 10 store its Library, etc.?
    ... rename the folders, delete all the entries from the MP 10 library (choose ... as MP3 files? ...
    (microsoft.public.multimedia.windows.mediaplayer)
  • Re: rerurning a boolean value
    ... >> since we do not care what exercise this is, ... >> rename on it to something sensible just before posting. ...
    (comp.lang.java.help)