glob and Traverse Directory

W

weberw

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?
 
P

Paul Lalli

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
 
T

Tad McClellan

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.
 
X

Xicheng Jia

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
 
R

robic0

Yes paul.

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
 
T

Tad McClellan

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).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top