From owner-freebsd-isp Mon Jan 18 14:55:42 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA26875 for freebsd-isp-outgoing; Mon, 18 Jan 1999 14:55:42 -0800 (PST) (envelope-from owner-freebsd-isp@FreeBSD.ORG) Received: from winter.adsight.com (adsight.com [207.86.2.34]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA26867 for ; Mon, 18 Jan 1999 14:55:40 -0800 (PST) (envelope-from webadmin@adsight.com) Received: from winter.adsight.com (winter.adsight.com [207.86.2.34]) by winter.adsight.com (8.8.8/8.8.7) with SMTP id RAA21467 for ; Mon, 18 Jan 1999 17:57:38 -0500 (EST) Date: Mon, 18 Jan 1999 17:57:38 -0500 (EST) From: Sam Magee To: freebsd-isp@FreeBSD.ORG Subject: Re: Need non-case sensitive fs In-Reply-To: <36A33253.106C@echidna.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I've used this script, which I hacked from a sample of something in the Camel book to convert webs to mostly case sensitive lower case. It seemed to catch about 99% of the problems I had with sites coming from Macintoshes. Put yourself in the public_html directory, create ../public_new and run this (standard disclaimers of course about this not being suited to any person's needs, etc): #!/usr/bin/perl # Converts Web site to use all lowercase links # Changes file names and anything in HTML TAG (Some exceptions) # Makes web copy from public_html to ../public_new/ (must exist) @inpath = ("./",); @outpath = ("../public_new/",); # index into the patharrays $curlevel = 0; # Start at the top &dodir('.'); sub dodir { local($dir,$nlink) = @_; local($dev,$ino,$mode,$subcount,@filenames); ($dev,$ino,$mode,$nlink) = stat('.') unless $nlink; opendir(DIR,'.') || die "Can't open directory"; @filenames = readdir(DIR); closedir(DIR); if ($nlink == 2) { # no sub-dirs for (@filenames) { next if $_ eq '.'; next if $_ eq '..'; $name = $inpath[$curlevel] . $_; $newname = $outpath[$curlevel] . $_; print "Level=$curlevel ",$name," <--> ",$newname,"\n"; &convert($name,$newname); } } else { $subcount = $nlink - 2; for (@filenames) { next if $_ eq '.'; next if $_ eq '..'; $name = $inpath[$curlevel] . $_; $newname = $outpath[$curlevel] . $_; print "Level=$curlevel ",$name," <--> ",$newname,"\n"; &convert($name,$newname); next if $subcount <= 0; ($dev,$ino,$mode,$nlink) = lstat($_); next unless -d _; chdir $_ or die "Can't cd to $name"; ++$curlevel; $outpath[$curlevel] = "../" . $outpath[$curlevel - 1] . $_ . "/"; $inpath[$curlevel] = "../" . $inpath[$curlevel - 1] . $_ . "/"; &dodir($name,$nlink); chdir '..'; --$curlevel; --$subcount; } } } # Called by covert($name,$newname) sub convert { ($name,$newname) = @_; $newname = &lcs($newname); if (-d $name) { system("mkdir $newname"); } elsif (-B $name) { system("cp $name $newname"); } else { open (INFILE,$name) || die "Can't open $name"; open (OUTFILE,">$newname") || die "Can't create $newname"; while () { $instr = $_; $instr=~s/(<[^>]*)/&lcs($1)/eg; print OUTFILE $instr; } close(OUTFILE); close(INFILE); } } sub lcs { $string=@_[0]; unless (/INPUT/i || /MAP/i || /META/i) { $string=~tr/A-Z/a-z/; } return($string); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message