Last change
on this file since 12484 was 3081, checked in by sjboddie, 22 years ago |
* empty log message *
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
875 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 |
|
---|
[3081] | 6 | die "\$GSDLOS not set !\n" if (!defined $ENV{GSDLOS});
|
---|
| 7 | my ($move, $separator);
|
---|
| 8 | if ($ENV{GSDLOS} eq "windows") {
|
---|
| 9 | $move = "move";
|
---|
| 10 | $separator = "\\";
|
---|
| 11 | } else {
|
---|
| 12 | $move = "mv";
|
---|
| 13 | $separator = "/";
|
---|
| 14 | }
|
---|
| 15 |
|
---|
[2815] | 16 | &recurse($ARGV[0]);
|
---|
| 17 |
|
---|
| 18 | sub recurse {
|
---|
| 19 | my ($dir) = @_;
|
---|
| 20 |
|
---|
| 21 | if (!-d $dir) {
|
---|
| 22 | print STDERR "ERROR: $dir isn't a directory\n";
|
---|
| 23 | return;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | opendir (DIR, $dir) || die;
|
---|
| 27 | my @files = readdir DIR;
|
---|
| 28 | closedir DIR;
|
---|
| 29 |
|
---|
| 30 | foreach my $file (@files) {
|
---|
| 31 | next if $file =~ /^\.\.?$/;
|
---|
[3081] | 32 | my $fullpath = "$dir$separator$file";
|
---|
[2815] | 33 | if (-d $fullpath) {
|
---|
| 34 | &recurse($fullpath);
|
---|
| 35 | } elsif ($file =~ /\.html?$/i) {
|
---|
| 36 | print STDERR "converting $fullpath\n";
|
---|
[3081] | 37 | `convert_toc.pl $fullpath $fullpath.new`;
|
---|
| 38 | `$move $fullpath.new $fullpath`;
|
---|
[2815] | 39 | }
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.