change meta tag description in all htm documents including all files in subdirectories

Discussion in 'Perl Misc' started by Tamara, Apr 6, 2004.

  1. Tamara

    Tamara Guest

    How can I change meta tag description in all htm documents including all
    files in subdirectories, with using perl on Windows XP?
    E.g. new meta tag is "New meta tag", and I want change it in all htm file
    including htm files in subdirectories.
     
    Tamara, Apr 6, 2004
    #1
    1. Advertising

  2. Tamara

    gnari Guest

    "Tamara" <> wrote in message
    news:c4v3ve$2es$...
    > How can I change meta tag description in all htm documents including all
    > files in subdirectories, with using perl on Windows XP?
    > E.g. new meta tag is "New meta tag", and I want change it in all htm file
    > including htm files in subdirectories.
    >


    use File::Find;

    gnari
     
    gnari, Apr 6, 2004
    #2
    1. Advertising

  3. On Tue, 6 Apr 2004 22:30:13 +0200, "Tamara" <>
    wrote:

    >How can I change meta tag description in all htm documents including all
    >files in subdirectories, with using perl on Windows XP?
    >E.g. new meta tag is "New meta tag", and I want change it in all htm file
    >including htm files in subdirectories.


    It is not clear at all what you want to do, but in any case File::Find
    seems the way to go, as another poster already suggested. OTOH this is
    not an help desk, however please see if you can adapt the following
    minimal example to your needs:

    #!/usr/bin/perl

    use strict;
    use warnings;
    use File::Find;

    my @dirs=grep { -d or !warn "`$_': no such directory!\n" } @ARGV;
    die "Usage: $0 <dir> [<dirs>]\n" unless @dirs;

    @ARGV=();

    find { no_chdir => 1,
    wanted => sub {
    push @ARGV, $_
    if /\.html?$/ and -f;
    } }, @dirs;

    $^I = '.bak';
    s|(</?)meta-tag>|$1actual-tag>|g, print while <>;

    __END__


    Michele
    --
    you'll see that it shouldn't be so. AND, the writting as usuall is
    fantastic incompetent. To illustrate, i quote:
    - Xah Lee trolling on clpmisc,
    "perl bug File::Basename and Perl's nature"
     
    Michele Dondi, Apr 7, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. intec studenf
    Replies:
    0
    Views:
    396
    intec studenf
    May 4, 2005
  2. Ralf Koms

    [JSP]: Including HTM files

    Ralf Koms, Oct 11, 2004, in forum: Java
    Replies:
    1
    Views:
    363
    Ralf Koms
    Oct 11, 2004
  3. shruds
    Replies:
    1
    Views:
    853
    John C. Bollinger
    Jan 27, 2006
  4. Sten Westerback

    Including .htm files conditionally?

    Sten Westerback, Feb 3, 2004, in forum: ASP General
    Replies:
    2
    Views:
    132
    Igor Tandetnik
    Feb 3, 2004
  5. Replies:
    6
    Views:
    170
    Dr.Ruud
    Feb 6, 2007
Loading...

Share This Page