g_speran has asked for the wisdom of the Perl Monks concerning the following question:
output:#!/usr/local/bin/perl use strict; use warnings; use MP3::Tag; my $mp3file = "01_rascal flatts_-_ here_comes_goodbye.mp3"; my $dir="c:\\temp\\music\\"; my $file="${dir}${mp3file}"; my $mp3 = MP3::Tag->new($file); my ($title, $tracknum, $artist, $album) = $mp3->autoinfo(); print "Artist is $artist\n"; print "Album is $album\n"; print "Title is $title\n"; print "Tracknum is $tracknum\n"; if ($title && $artist) { print "OK\n"; my $rename_to="${dir}${artist}_${title}.mp3"; rename($file, "${rename_to}") or warn "Couldn't rename $file to +$rename_to: $!\n"; }
ThanksC:\temp>perl mp3_rename.pl Artist is Rascal Flatts Album is Unstoppable Title is Here Comes Goodbye Tracknum is 2 OK Couldn't rename c:\temp\music\01_rascal flatts_-_ here_comes_goodbye.m +p3 to c:\temp\music\Rascal Flatts_Here Comes Goodbye.mp3: Permission +denied
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Renaming a file
by jwkrahn (Abbot) on Dec 16, 2009 at 18:38 UTC | |
by Anonymous Monk on Dec 16, 2009 at 20:24 UTC | |
|
Re: Renaming a file
by matze77 (Friar) on Dec 16, 2009 at 18:32 UTC | |
by Anonymous Monk on Dec 16, 2009 at 18:40 UTC |