Dirhtml Help - Notes

Statistics Per Anchor The number of files in an /ANCHOR subsection can be inserted by using %%ANCHOR_TOTAL_FILES%, and the size of all linked files with %%ANCHOR_TOTAL_SIZE%
Code Insertion By File Type To customize links based on file type (e.g. *.mp3, this_file.txt), use a /FILE_MATCHES section.  These sections can provide quite interesting results, for example this page.
Search Details    To add code showing details about the current search at the top of generated pages, use something along these lines:
/START
<p style="text-align: center; margin-top: 0px; font-weight: bold">
<span style="font-size: x-large">%%DIR</span><br />
<span style="font-size: large">
Files: %%SPEC<br />
Include: %%INCLUDES<br />
Exclude: %%SKIPPED</span><br />
%%DATE</p>
Auto‑Generated Index Files    To automatically regenerate server index files upon access, use PHP.  Configure dirhtml as follows:
  • Set the folder (F4) to "."
  • Set the output file to "list.html"
  • Exclude files matching "build_html" (and possibly also "list.html")
  • Turn auto-launch of generated files off (Input/Output page)
  • Create a batch file (F7) in the folder of interest named "build_html.bat"
  • Create a PHP file with these contents: (to be saved as "index.php")
    <? exec ('build_html.bat');
    $file = file_get_contents ('list.html');
    echo $file;
    ?>
  • Launch the automatically regenerated file by opening index.php
  • Note that the batch file can also point to a generic .ini file on the server.  It is also possible to redirect any index file on a server folder branch to a recursively built file using similar methods.

Index.html can be redirected to the index.php file by overwriting it with this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><meta http-equiv="REFRESH" content="0;url=index.php"></head>
<body></body>
</html>
Task Scheduler As an alternative to using php to generate files, Windows Task Scheduler can regenerate html files periodically.   To generate files using the scheduler, create a batch file (f7) that builds the desired file(s), then set up the scheduler to run the batch file periodically.
Network Drives Dirhtml can index Windows accessible network drives.
Deleting Strings    Pressing Delete while a drop-down list is open deletes the focused string from the list.
Chopped Files If a generated file gets cut off in mid-file, one or more indexed filenames probably has a non-ascii character that is being interpreted as an end of file marker.  Use a UTF-8 or UTF-16LE character set if this occurs.
Save/Restore Settings    When a particular build works well, save the settings by pressing F9.  The settings be can reopened later with F8.
Daunting Scripts Some of the scripts distributed with dirhtml are complex.  It's not necessary to learn every section to customize scripts.  Editing a script (F11) and adding some code to the /START section can provide useful results.   Most of the distributed scripts define table properties with CSS and can be used a starting point.   Also, examine the Script Lessons help page.
Tooltips To see tooltips for dropdown lists, hover over the down arrows.
Page Jumping Ctrl+PgUp and Ctrl+PgDn scroll through the tabs.
Server PointingTo make links point to a particular server use a folder or file prefix or a base href.
Stupid TrickDepending on the locale, your operating sytem may sort _ before other characters.  Try renaming folders and files with _ as the first character (e.g. _saved.ini), so they will appear first in file managers when sorted by name.
Including Per-Folder FilesWhen building a single recursive file, it is possible to include a specific file in folder headers using a %%FILE...% variable.  Non-recursive files can also use %%FILE...% variables.

For example, use a script including something like this:
/ANCHOR
</td></tr>
<tr><td colspan="%%COLUMNS%" class="note">%%FILEdescription.txt%


...with a description.txt file in the folder(s) of interest that includes html code, such as:
Here is some text that <b>describes</b> the folder...
Last Access In Windows 7  In Windows 7, the file system may not automatically save "last access" data.  To re-enable saving "last access" data, do this:
  • Click the Start Menu
  • Enter "cmd" in the search box
  • Press Ctrl+Shift+Enter (which starts cmd as an administrator)
  • Determine the last access setting by entering: "fsutil behavior query DisableLastAccess"
  • Re-enable last access by entering: fsutil behavior set DisableLastAccess 0

Note that when dirhtml scans a folder for matching filenames under Windows 7 (and last access is enabled), the last access date for every file in the folder is updated, which makes the whole exercise somewhat pointless.