Zdir: A Practical Directory Listing Program

Publish: 2018-06-20 | Modify: 2020-04-12

The latest version v1.31 has been updated. Please go to Github to download: https://github.com/helloxz/zdir/releases

I originally planned to build my own front-end library, but after searching online for a directory listing program, I found that none of them suited my taste. So I decided to build my own, and that's how Zdir was born. Zdir is a directory listing program developed using PHP. It doesn't require a database and is easy to install and use.

Zdir

Main Features

  • Directory browsing
  • MarkDown file preview
  • CSS/JavaScript one-click copying
  • View file hash
  • Image preview
  • File indexing
  • File search (dependent on file indexing)
  • File management (upload/download/delete, etc.)
  • QR code support
  • Video/music playback
  • Text viewing
  • Office online preview

Detailed Features (not exhaustive)

MarkDown file preview

If it's a MarkDown file (*.md), a small eye button will appear next to it. Clicking this button allows you to preview the file.

MarkDown preview

If the file is named readme.md, a "Usage Instructions" button will appear, which also allows you to preview the file, as shown in the screenshot below.

Readme preview

Link copying

The copy button returns different results based on the file type. This is very helpful when building a front-end library. For example:

<!-- If the file being copied is a .js file, the result will be -->
<script src='https://libs.xiaoz.top/jquery/2.0.3/jquery-2.0.3.js'></script>
<!-- If the file being copied is a .css file, the result will be -->
<link rel='stylesheet' href='https://libs.xiaoz.top/layer/skin/layer.css'>
<!-- If it's an image or other file -->
<img src='https://libs.xiaoz.top/material/loading/loading0.gif' />

Other files will return the file URL address.

View file hash

Clicking the exclamation mark button next to a file can calculate the file's MD5 and SHA1 values, allowing you to verify the file's hash and avoid risks such as ISP hijacking.

File hash

Image preview

Moving the mouse over an image file will display a preview, as shown in the screenshot below.

Image preview

File indexing

If there are too many files and it's not convenient to search for them, Zdir does not currently have a file search function. However, with the "File Indexing" feature and the "Ctrl + F" shortcut, finding files is a breeze.

File indexing

The "File Indexing" cache is valid for 24 hours. If you want to clear the cache immediately, please visit cache.php?del=cache.

The above are just some of the features. Feel free to download and install to experience more.

Usage

  • Download the source code and place it in the root directory of your site.
  • Rename config.simple.php to config.php.
  • Set site information/passwords, etc. in config.php.

Related Recommendations

Summary

Based on the directory listing programs I have used, h5ai has powerful features, but the configuration is slightly cumbersome and the code is obfuscated, making it unsuitable for further modification.

PHP Directory Lister is simple and practical, but it loads resources from outside the Great Firewall, which is not convenient for beginners. Additionally, some of Zdir's development ideas were borrowed from PHP Directory Lister.

Although Zdir has simple functionality, it is suitable for use. Click the link below to download.


Comments