LinuxQuestions.org
Review your favorite Linux distribution.
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 11-30-2004, 10:05 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
file manager to htmlHi


hi.....I need a simple program that creates a html file with the contents of my directory.... Do u have to suggest me something?
 
Old 11-30-2004, 11:37 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
Create a file toHTML.sh (for example) with this content:
Code:
#!/bin/bash
# $1: first parameter is the directory, the content of which
#     is to be displayed (current directory if not given).
# $2: second parameter is the output file (directory.html for
#     example). If none giver, result is put to standard out.

if [ -n "$2" ]; then
  exec 1>"$2" || exit 1
else
  exec 2>/dev/null
fi

cd "${1:-.}" || exit 1

cat <<-THEEND
<html><head>
<title>Content of: ${1:-.}</title>
</head><body>
<ul style="font-family: monospace;">
THEEND

/bin/ls -liaF | grep -v "^total" | sed 's/^\(.*\)$/  <li>\1</li>/'

cat <<-THEEND
</ul>
</body></html>
THEEND
Use it like that to have the content of /usr/share/icons stored in a file called icons.html in your home directory:
$ toHTML.sh /usr/share/icons $HOME/icons.html

Yves.

Last edited by theYinYeti; 12-01-2004 at 02:13 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
The right File Manager for me? mugendai Linux - Newbie 4 04-11-2005 01:58 PM
No File manager bowen199 Linux - Newbie 1 09-16-2004 05:33 PM
[Gentoo file manager] Install RPM from the file manager? Coume Linux - Software 2 12-10-2003 02:21 AM
File Manager Nik Linux - Software 9 10-23-2003 03:00 PM
file manager killi Linux - Software 3 05-17-2003 04:26 AM

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

All times are GMT -5. The time now is 12:36 AM.

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