Help for this page

Select Code to Download


  1. or download this
    $dir="/home/yehuda/img/jpg/";
    chop $dir;
    
  2. or download this
    while (defined ($img=readdir DH)){
    $img=~m/^(.*)\.(.*)\.(.*)/g;
    $newname="$1.$3";
    
  3. or download this
    push @names,$img;
    push @newnames,$newname;
    }
    
  4. or download this
    close DH;
    
  5. or download this
    foreach $name(@names){
    $i=$i+1 ;
    $newname_=$newnames[$i-1];
    
  6. or download this
    $path="$dir/$name";
    $target="$dir/$newname_";
    
  7. or download this
    chomp($target,$path);
    
  8. or download this
    rename ($path,$target) or die "Could not rename:$!";
    print "  $path   is now $target \n";
    
  9. or download this
    $dir="/home/yehuda/img/jpg";
    
    ...
        }
    }
    closedir DH;