glob and Traverse Directory

Discussion in 'Perl Misc' started by weberw@adelphia.net, Jul 14, 2006.

  1. Guest

    In Perl , When I am traversing through a directory of files and I want
    to create an html link when the file extension is .html how would you
    do this?
     
    , Jul 14, 2006
    #1
    1. Advertising

  2. Paul Lalli Guest

    wrote:
    > In Perl , When I am traversing through a directory of files and I want
    > to create an html link when the file extension is .html how would you
    > do this?


    I would write a Perl program to do it for me.

    How have you tried to do it?

    Paul Lalli
     
    Paul Lalli, Jul 14, 2006
    #2
    1. Advertising

  3. <> wrote:

    > In Perl , When I am traversing through a directory of files and I want
    > to create an html link when the file extension is .html how would you
    > do this?



    I would do it with the m// operator and the print() function.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jul 14, 2006
    #3
  4. Gunnar Hjalmarsson, Jul 14, 2006
    #4
  5. Xicheng Jia Guest

    wrote:
    > In Perl , When I am traversing through a directory of files and I want
    > to create an html link when the file extension is .html how would you
    > do this?


    you can use find/perl on the Linux command line:

    find -type f -name '*.html' -print0 | perl -F/ -aln0e 'print qq(<a
    href="$_">$F[-1]</a>)'

    Xicheng
     
    Xicheng Jia, Jul 14, 2006
    #5
  6. Guest

    Yes paul.
    Paul Lalli wrote:
    > wrote:
    > > In Perl , When I am traversing through a directory of files and I want
    > > to create an html link when the file extension is .html how would you
    > > do this?

    >
    > I would write a Perl program to do it for me.
    >
    > How have you tried to do it?
    >
    > Paul Lalli
     
    , Jul 14, 2006
    #6
  7. robic0 Guest

    On 14 Jul 2006 14:31:04 -0700, "" <> wrote:

    >Yes paul.
    >Paul Lalli wrote:
    >> wrote:
    >> > In Perl , When I am traversing through a directory of files and I want
    >> > to create an html link when the file extension is .html how would you
    >> > do this?

    >>
    >> I would write a Perl program to do it for me.
    >>
    >> How have you tried to do it?
    >>
    >> Paul Lalli


    Well lets see here. Apparently finding *.html in a directory is alot
    easier than creating a link. 50/50. Where does the link go? E-mail,
    a web page from a cgi, asp, a Word doc? What good is semi-automation?

    robic0
     
    robic0, Jul 15, 2006
    #7
  8. <> wrote:
    > Paul Lalli wrote:
    >> wrote:
    >> > In Perl , When I am traversing through a directory of files and I want
    >> > to create an html link when the file extension is .html how would you
    >> > do this?

    >>
    >> I would write a Perl program to do it for me.
    >>
    >> How have you tried to do it?
    >>

    > Yes paul.



    He didn't ask if you tried to do it, he asked *how* you tried to do it.

    Let's see what you tried!

    We can often fix code (if we can see the code).


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jul 15, 2006
    #8
    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. Georgy Pruss
    Replies:
    15
    Views:
    751
    Tim Roberts
    Dec 1, 2003
  2. Tim Peters
    Replies:
    1
    Views:
    375
    Duncan Booth
    Dec 1, 2003
  3. Sean Berry

    Question about glob.glob <--newbie

    Sean Berry, May 4, 2004, in forum: Python
    Replies:
    3
    Views:
    356
    David M. Cooke
    May 4, 2004
  4. lameck kassana
    Replies:
    0
    Views:
    300
    lameck kassana
    Feb 26, 2009
  5. Matthew Denner
    Replies:
    1
    Views:
    211
Loading...

Share This Page