Help for this page

Select Code to Download


  1. or download this
    ren *.log *.txt
    
  2. or download this
    for f in /tmp/*.log ; do mv $f ${f%%.*}.txt; done
    
  3. or download this
    my @files = File::Find::Rule->file()->name('*.log')->maxdepth(1)->in($
    +destinationDirectory);
    foreach my $src ( @files ){
      my $dest = $src; $dest =~ s/[^.]+$/txt/;
      rename $src, $dest;
    }