Skip to content

Tinigrifi/TreeHtml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

TreeHtml

A Perl script that generates a clean, self-contained HTML index page for any directory — with recursive tree view, file-type icons, human-readable sizes, and multi-language support.

Features

  • 📁 Tree view with CSS-drawn connector lines (├──, └──)
  • 🎨 File-type icons based on extension (images, videos, audio, code, archives…)
  • 📏 Human-readable file sizes (B, KB, MB, GB…)
  • 🔗 Relative links with proper URL encoding (accented filenames supported)
  • 🌍 Multi-language output — 11 languages supported
  • 🔁 Recursive by default, optional flat listing with -n
  • ✏️ Custom title via -t
  • 🌙 Dark mode via -d

Requirements

Perl 5.10+ with standard modules:

  • Encode (core)
  • File::Basename (core)
  • Cwd (core)
  • Getopt::Long (core)

No CPAN modules required.

Usage

perl make_index.pl [options] [directory]

If no directory is given, the current directory is used.

Options

Option Long form Description
-t TITLE --title TITLE Custom title (replaces the default "Index of …")
-n --no-recursive Flat listing — do not recurse into subdirectories
-l CODE --language CODE Language for the HTML page output (default: en)
-d --dark Use dark theme
-h --help Show help

Examples

# Current directory, recursive (default)
perl make_index.pl

# Top-level only
perl make_index.pl -n

# Custom title, French output
perl make_index.pl -t "Mes fichiers" -l fr

# Dark theme
perl make_index.pl --dark

# Specific directory, German output, no recursion
perl make_index.pl --no-recursive --language de /path/to/folder

Supported languages (-l)

Code Language
en English (default)
fr French
de German
es Spanish
it Italian
pt Portuguese
nl Dutch
pl Polish
ru Russian
ja Japanese
zh Chinese

The help (-h) is always displayed in English.
Console output (paths, counts) is always in English.
Only the HTML page content is translated.

File-type icons

Icon Types
🖼️ jpg, png, gif, svg, webp, heic…
🎬 mp4, avi, mkv, mov, divx, webm…
🎵 mp3, wav, flac, ogg, opus…
📕 pdf
📝 doc, docx, odt, rtf
📊 xls, xlsx, csv, ods
📋 ppt, pptx, odp
📦 zip, tar, gz, 7z, rar, xz…
💻 pl, py, js, ts, c, cpp, java, go, rs…
🌐 html, css, jsx, vue…
⚙️ sh, bash, zsh, bat, ps1
🔧 json, yaml, xml, ini, toml, env…
🗄️ db, sqlite, sql
🔤 ttf, otf, woff, woff2
🖥️ exe, deb, rpm, iso, apk…
📄 txt, md, log, and everything else

Output

The script generates an index.html file directly in the target directory.

Files and directories starting with . (hidden) are excluded, as are index.html and the script itself.

License

MIT

About

Perl script that generates a self-contained HTML directory index with tree view, file-type icons, human-readable sizes, and multi-language support.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages