Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


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

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


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.


Old 03-21-2005, 12:59 PM   #2
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:

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, 02:47 AM   #3
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 02:50 AM.


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 11:55 PM
apache server setup and how to place files in the var/www/html directory dramous Linux - Newbie 7 09-28-2004 05:18 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - Software 3 09-25-2004 03:38 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - General 2 09-25-2004 02:29 AM
missing html files in my home directory scottsteib Linux - Newbie 0 07-29-2003 10:13 AM > Forums > Linux Forums > Linux - Software

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

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