#!/usr/local/bin/perl -w # force taint checks, and print warnings #use strict; # install all three strictures # program to open files in a directory and change directory paths from oldpath to $newpath # use stat function to mke file handles available $|++; # force auto flush of output buffer use File::Find; #define full path to folder my $path = " /users/hill/desktop/test_src/"; my $newpath = "/library/webserver/documents/siteroot/installfolder/"; #define string my $newString = 'newDir/newFile'; my $oldString = 'oldDir/oldFile'; # define arrays my @ListofFiles; #define string directory as my $Start_dir = shift or die "usage: $0 \n"; unless (-d $Start_dir){ die "Start directory .'$Start_dir' . is not a directory.\n"; } find(\&process, $Start_dir); sub process{ my $content = ''; # add filename to ListofFiles push(@ListofFiles, $File::Find::name); my $fileopened = $File::Find::name; unless (open FILEOPENED, $fileopened ) { warn "couldn't open the file $fileopened .... ! $!"; return; } my $data =join '', ; close(FILEOPENED); return unless $data; print "file is :: $File::Find::name\n"; print "found the file $fileopened \n\n reading the following data \n\n $data\n\n\n"; }