use File::Find; my $oldroot = shift; my $newroot = shift; find(\&wanted, $oldroot); sub wanted { # Chop off $oldroot prefix, glom on $newroot prefix print $newroot, substr($File::Find::name,length($oldroot), "\n"; }