MELRandomRename

From scripting
Jump to: navigation, search
global proc RandomRename(string $SearchStr, string $ReplStr) {
  //Bernice Ngo and Nick Pisca 2010
  string $VMF_Obj[] = `ls -tr $SearchStr`;
  int $VMF_ObjSize = `size($VMF_Obj)`;
  if ($VMF_ObjSize != 0) {
     int $random = rand (0, $VMF_ObjSize);
     rename $VMF_Obj[$random] $ReplStr ;
  }
}