Krish wrote:
> 
> Hi,

Hello,

> I am a beginner in Perl and have a very trivial query. I have some .expect
> files in my directory structure which are spread all throughout. I want to
> convert these files (only expect files) to .expect.bak.  Please let me know
> as to how this can be done using Perl script. Even pointers to shell
> scripting will help.


#!/usr/bin/perl -w
use strict;
use File::Find;

my @files;
find( sub { /\.expect$/ and push @files, $File::Find::name }, '/' );

for my $file ( @files ) {
    rename $file, "$file.bak" or warn "Cannot rename $file to $file.bak:
$!";
    }

__END__


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to