Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This is a question not even worthy of your consideration, but you could help this lowly perl novice out of a rut...that novice would be very, very appreciative. :}

I know any and all of you can whip this easy piece of code out in a second, so if you could, please *please* tell me how to change files using server-side includes from .HTML to .SHTML. I've changed to a new server running Apache and something's wrong with the xbithack thing that's usually done and now I have to face the worst-case scenario task of changing all the .html to .shtml to accomodate for this.

Furthermore, I have no-one left to ask.

Thanks in advance for any help.

Replies are listed 'Best First'.
Re: HTML to SHTML to Accomodate SSI's
by blakem (Monsignor) on Oct 11, 2002 at 10:58 UTC
    If you're on unix and have the standard find and rename utilities installed, this should work for you.
    % cd YourDocRoot % find . -name '*.html' -exec rename .html .shtml '{}' \;
    Though you should test it in a temporary directory first.

    Update: Here is a faster version using xargs

    % find . -name '*.html' -print0 | xargs -0 rename .html .shtml

    -Blake

Re: HTML to SHTML to Accomodate SSI's
by PodMaster (Abbot) on Oct 11, 2002 at 10:52 UTC
    Hmm, you could've asked the manual (how to rtfm)

    This is the what you'll get:
    perldoc -f glob
    perldoc File::Find
    perldoc -f rename
    You should be able to figure it out, if not, come back, show us your code, and we'll go from there.

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

•Re: HTML to SHTML to Accomodate SSI's
by merlyn (Sage) on Oct 11, 2002 at 13:50 UTC
    Furthermore, I have no-one left to ask.
    Either you're the webmaster, or someone is. If that someone is, please ask them.

    If it's you, then you have full control over the webserver, and renaming files should be the last resort.

    Instead, add XBitHack On to your top-level configuration file. That should work fine. If it doesn't, see the tutorial on SSI at the Apache site. Make sure you have the Include options enabled.

    There is no need to rename the file. It ruins bookmarks to your site, internal references, and is a waste of everyone's time.

    -- Randal L. Schwartz, Perl hacker

Re: HTML to SHTML to Accomodate SSI's
by fglock (Vicar) on Oct 11, 2002 at 11:40 UTC

    And, of course, you will have to change all your links inside the pages to .shtml