#!/usr/bin/perl use strict; use warnings; use File::Copy; ### Convert all filenames within /attach subdir to lowercase ### my $attchdir = '/attach'; chdir($attchdir) or die "Can't chdir to $attchdir $!"; opendir(ATTCHDIR, $attchdir) || die "Couldn't opendir: $!\n"; my @attchfiles = grep { $_ ne '.' && $_ ne '..' } readdir ATTCHDIR; foreach(@attchfiles) { my $attchfilename = $_; $attchfilename =~ tr/A-Z/a-z/; rename($_, $attchfilename); } closedir(ATTCHDIR); ### ### my $dir = '/html'; opendir(DIR, $dir) or die "Cannot open directory: $!\n"; my @files = readdir(DIR); closedir(DIR); foreach(@files) { my $filename = $_; open(FILE, $filename); while (my $data = ) { #print $data; $data =~ s/red/blue/g; } close(FILE); }