Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor
New user
uploaded files
|
(linux_command_line)-> (Parent)->complex renaming |
submited by Russell Wed 14 Feb 07 |
there might well be a trick to do this on thc command line, but I'm not that skilled. to do what you described, I wrote a simple perl program:
open (IN, "ls music[0-9][0-9]*.mp3|");
do{
$line=<IN>;
chomp $line;
$newname=substr($line,0,7).".mp3"; ## builds new name using first 7
##chars of oldname
if (!-e $newname) ## don't try if the new name already exits
{
print `mv -vi '$line' '$newname'`;
};
} until eof(IN);
paste this into a perl (text) file (music_renamer.pl) then run it with the command perl music_renamer.pl with the files you want to change in the current directory.
This Should be safe, because it won't overwrite an existing file, but non-the-less, you should backup your files first incase something goes terribly wrong.
|
Add comment or question...:
|