Kangry.com [insert cool graphic here]
home | Topics | Logout | Search | Contact | ?? Kangry ?? | Bandwitdh
Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor

Name

Password

New user

uploaded files
(linux_command_line)-> (Parent)->complex renaming submited by Russell Wed 14 Feb 07
Web kangry.com
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...:
Subject:
Submited by: NOT email address. Leave blank for anonymous    (Spam Policy)

Enter Text: (text must match image for posting)




This file (the script that presented the data, not the data itself) , last modified Tuesday 06th of March 2018 11:41:12 PM
your client: claudebot
current time: Thursday 28th of March 2024 06:22:22 AM