LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-20-2005, 08:23 PM   #1
flamesrock
Member
 
Registered: Aug 2003
Distribution: Gentoo 2006.1
Posts: 405

Rep: Reputation: 30
script needed: directory -> html with links to all files in dire


Hi,

I have a directory on my server with a huge number of mp3 song demos (all of them legal). What I want to do is, instead of having a directory listing which displays only part of the song title, have a script or program generate an html file with links to each song, so that you can see the whole title.

Since this is shared hosting, I don't think I can do anything with root.

ideas?

-thanks
 
Old 03-21-2005, 11:59 AM   #2
huibert.alblas
Member
 
Registered: Jan 2004
Location: Duesseldorf /Germany
Distribution: Gentoo amd64 / Debian
Posts: 226

Rep: Reputation: 30
3-liner in Bash :-)

From the directory containing the mp3 files:

Code:
echo "<html><head><title>My MP3 List</title></head><body>Please klick these Links :-)<br>" > index.html
ls *.mp3 | while read MP3NAME; do echo "<p><a href=\"$MP3NAME\">$MP3NAME</a></p>" >> index.html ; done; 
echo '<p>Thats all folks!' >> index.html
And thats it.
 
Old 03-22-2005, 01:47 AM   #3
JohnBoy
Member
 
Registered: Oct 2003
Distribution: Debian, RH, Knoppix, Ubuntu, CentOS
Posts: 62

Rep: Reputation: 15
Ignore me -- try the script from Huibert!

You ought to be able to do this with a Perl script if Perl is installed on the box and you have a cgi-bin directory (for executable scripts). But if the contents of the dir are not changing you don't need the server side support. What you'd need -- if you have a lot of entries -- is a directory listing. If directory browsing is enabled, just browsing the dir will get you an HTML-encoded list of songs. What you'd need to change is the link text, since the href value would be the full song title.

Last edited by JohnBoy; 03-22-2005 at 01:50 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically Copying files from the ftp directory into the html directory swatward Linux - General 3 04-17-2005 10:55 PM
apache server setup and how to place files in the var/www/html directory dramous Linux - Newbie 7 09-28-2004 04:18 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - Software 3 09-25-2004 02:38 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - General 2 09-25-2004 01:29 AM
missing html files in my home directory scottsteib Linux - Newbie 0 07-29-2003 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration