#!/usr/bin/perl -w use strict; Scan( '/home/greg/mydir' ); sub Scan { my( $dir, $path )= @_; $path ||= "."; chdir $dir or die "Can't chdir($dir) from $path: $!\n"; $path= $dir if "." eq $path; my @files= ( glob("*"), grep "." ne $_ && ".." ne $_, glob(".*") ); for my $sub ( grep ! -l $_ && -d _, @files ) { Scan( $sub, "$path/$sub" ); } if( grep /\.old$/, @files ) { local( @ARGV )= "CPB"; local( $^I )= ".old"; while( <> ) { if( /^cat/ ) { print "cat\t/kat/src/all/b-ld_pipe.4go \\\n"; s/^cat\t/\t/; } print; } } chdir ".."; }