#!perl # # サイト移転用 HTML 生成スクリプト # $newsite = 'http://homepage3.nifty.com/k-takata/'; $level = 0; dirlist(); sub dirlist { my ($dir) = @_; $dir .= "/" if ($dir ne ""); my (@dirlist) = glob $dir."*"; my ($f); foreach $f (@dirlist) { if (-d $f) { print $f."/\n"; $level++; dirlist($f); $level--; } else { if ($f =~ /\.html$/) { modhtml($f); } # print $f."\n"; } } } sub modhtml { my ($html) = @_; my ($htmlbak, $title, $style, $i); $htmlbak = $html.".bak"; print $html."\n"; rename($html, $htmlbak); open(IN, "<", $htmlbak); open(OUT, ">", $html); my ($sec, $min, $hour, $mday, $mon, $year) = localtime(); $year += 1900; $mon++; my ($date); $date = sprintf("%04d/%02d/%02d", $year, $mon, $mday); $style = "style.css"; for ($i = 0; $i < $level; $i++) { $style = "../".$style; } while () { if (/(.*)<\/title>/) { $title = $1; } if (/(.*)<\/h1>/) { $h1 = $1; } } $msg=<<"MSG"; $title $h1 $date 更新 移転しました。新しい URL は $newsite$html です。 ブックマークやリンクしている方は変更しておいてください。 新しいトップページは、$newsite です。 (今まで通り、http://webs.to/ken/ も有効です。) 10秒後に新ページへジャンプします。 MSG print OUT $msg; close(IN); close(OUT); }
$date 更新
移転しました。新しい URL は $newsite$html です。 ブックマークやリンクしている方は変更しておいてください。
新しいトップページは、$newsite です。 (今まで通り、http://webs.to/ken/ も有効です。)
10秒後に新ページへジャンプします。