Skip to main content

HTML directory listing

Project description

LinuxDir2HTML

LinuxDir2HTML is a small program to help create an offline manifest of your files in an easily navigable html format. It is a CLI-only clone of Snap2HTML. LinuxDir2HTML is a rewrite of DiogenesList, making significant improvements to it:

  • Python 3.6+
  • Doesn't fail on symlinks (symlinks are ignored)
  • More graceful invocation and sane usage
  • Much, much, much faster
  • Highly improved code

LinuxDir2HTML will produce essentially an identical output to Snap2HTML by using the same HTML template from that project.

Installation

Python PIP Install

Linux

python -m pip install --user linuxdir2html

macOS

python3 -m pip install --user linuxdir2html

Basic Install

There are no external dependencies. If you do not wish to use pip, download linuxdir2html.py and template.html. Run the python directly.

Usage

The program takes two mandatory arguments, the directory to be indexed and the output file name without the extension. So:

linuxdir2html ~/Pictures output

will index the contents of /home/Pictures and save the index as output.html in the present working directory.

Extra options

There are two optional flags. --hidden to include hidden files and directories, and --links to make the HTML link to the files directly.

By user request, newly introduced in v1.4.0 are a stacking --startswithand --child parameters. For example,

linuxdir2html --startswith 'dev' --child 'Pictures' ~ ~/output

will select directories that start with 'dev' and the directory named 'Pictures' from the the user's home directory. The --startswith filter only affects the root search directory, all subdirectories and files will be indexed. The hidden flag is usable with the startswith flag.

License

The LinuxDir2HTML.py file is licensed under GPLv2.

The template.html file Copyright (C) by Dan and is licensed as GPLv3.

Notes

  • There are no plans to implement a GUI.
  • The up-to-date template uses epoch time and converts to your locale. If you'd like to change this behavior, update the JS function timestampToDate in the template.
  • Certain characters like \n I've chosen to not implement handling for. In my humble opinion, just don't use new lines in file names :)
  • Files with * in their names will not break the html output, but it may cause issues with the --links feature, and truncate the file names and cause minor metadata issues.
  • LinuxDir2HTML requires Python 3.6 or greater, but if you modify the code to remove string interpolation and the barely used pathlib, the minimum required version will be much lower.

Similar programs

I have long used an excellent program called ncdu to perform a similar function to WinDirStat or Disk Inventory X. I recently learned it has an export feature which you may find useful. Consider using it!

Export a directory and browse it once scanning is done:

ncdu -o- ~/book | tee ~/ncduscan.file | ncdu -f-

Browse the contents of the file, without rescanning:

ncdu -f ~/ncduscan.file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linuxdir2html-1.5.0.tar.gz (86.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linuxdir2html-1.5.0-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file linuxdir2html-1.5.0.tar.gz.

File metadata

  • Download URL: linuxdir2html-1.5.0.tar.gz
  • Upload date:
  • Size: 86.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for linuxdir2html-1.5.0.tar.gz
Algorithm Hash digest
SHA256 5a9617ea6b3c911af6bf4e0ec280db22ac601327683e5eda5c4137f22256f049
MD5 1785205ee95a0757aa53d69e89568948
BLAKE2b-256 cd1e5aaa5d9a556119b8600ddb5c8a0b0e00fc96be7fa5478ad511bfdf249919

See more details on using hashes here.

File details

Details for the file linuxdir2html-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: linuxdir2html-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for linuxdir2html-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09d5638af19055de64260c90b377aa427080f248d3b86b2f77c375b1b799f7d2
MD5 48a674dbbd77bfa7ea51e08fb2b160b3
BLAKE2b-256 a68b795b8438a40cb38e773a18c83f827d4b2d93ed98d2bbc9e0667b210a7aac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page