#!/usr/bin/perl -w # Type in the name of the directory containing the files you wish to rename $DIR = './test-dir'; # Type in the new file extension (file suffix) you wish to give the files $SUF = 'foo'; use strict; use vars qw( $DIR $SUF ); use Futils qw( n ); my($f) = Futils->new(); my(@op) = qw( --files-only --no-fsdots --with-paths ); my(@files) = $f->list_dir($DIR, @op); foreach (@files) { rename($_, $_ =~ /(^.*)\./ ? qq[$1.$SUF] : qq[$_.$SUF]) } my($i) = 0; map { $files[$i] = [$files[$i],$_]; ++$i } $f->list_dir($DIR, @op); foreach (@files) { print(qq['$_->[0]' -> '$_->[1]'] . n); } =pod AUTHOR Tommy Butler phone: (817)-468-7716 6711 Forest Park Dr Arlington, TX 76001-8403 COPYRIGHT Tommy Butler. All rights reserved LISCENCE This software is free, use/distribute under the GNU GPL. BUGS TO Tommy Butler This code uses Futils, a Perl module (or reusable code library) to make life easier when doing things with files. You can download the code at: Futils uses other modules, which may be also be found here at the ooOPps Open Source Code Library under the "modules" section. Refer to the itemized list below for more specific information: "Handy::Dandy" used by: Futils file name Dandy.pm get it at: /pub/modules/Handy/Dandy.pm "OOorNo" used by: Futils, Handy::Dandy file name: OOorNo.pm get it at: /pub/modules/OOorNo.pm "Handy::Dandy::TimeTools" used by: Handy::Dandy file name: TimeTools.pm get it at: /pub/modules/Handy/Dandy/TimeTools.pm =cut