Last change
on this file since 2815 was 2815, checked in by sjboddie, 23 years ago |
created some scripts for converting old <<TOC>> type files to the new
<Section> type format
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
668 bytes
|
Rev | Line | |
---|
[2815] | 1 | #! /usr/bin/perl -w
|
---|
| 2 |
|
---|
| 3 | # run convert_toc.pl on any html files found in the directory passed in on
|
---|
| 4 | # the command line (or any subdirs).
|
---|
| 5 |
|
---|
| 6 | &recurse($ARGV[0]);
|
---|
| 7 |
|
---|
| 8 | sub recurse {
|
---|
| 9 | my ($dir) = @_;
|
---|
| 10 |
|
---|
| 11 | if (!-d $dir) {
|
---|
| 12 | print STDERR "ERROR: $dir isn't a directory\n";
|
---|
| 13 | return;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | opendir (DIR, $dir) || die;
|
---|
| 17 | my @files = readdir DIR;
|
---|
| 18 | closedir DIR;
|
---|
| 19 |
|
---|
| 20 | foreach my $file (@files) {
|
---|
| 21 | next if $file =~ /^\.\.?$/;
|
---|
| 22 | my $fullpath = "$dir/$file";
|
---|
| 23 | if (-d $fullpath) {
|
---|
| 24 | &recurse($fullpath);
|
---|
| 25 | } elsif ($file =~ /\.html?$/i) {
|
---|
| 26 | print STDERR "converting $fullpath\n";
|
---|
| 27 | `convert_toc.pl < $fullpath > $fullpath.new`;
|
---|
| 28 | `mv $fullpath.new $fullpath`;
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.