diff --git a/mkindex.py b/mkindex.py
new file mode 100755
index 0000000..cca29ef
--- /dev/null
+++ b/mkindex.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+
+import sys, os, re, datetime, locale
+
+webbasedir = os.path.expanduser("~/www/i21k.de/")
+
+### for module mkdirindex:
+targetdir = webbasedir + "test/"
+indexfilename = "index.html"
+targetdirheadline = "Statements, rants and articles, mostly in german."
+showsize = 0
+####
+
+
+def mkdirindex(targetdir, indexfilename, targetdirheadline, showsize):
+ """Dig a directory and generate an index."""
+
+ head1 = (
+ '
\n \n'
+ + targetdirheadline
+ + '\n \n \n '
+ )
+
+ style_fn = ''
+ head2 = ""
+ body1 = 'Main
'
+ body1 += '' + targetdirheadline + "
"
+ body1 += '
Some byebye
\n'
+ linecounter = 0
+
+ dirindexfile = open(targetdir + indexfilename, "w")
+
+ dirindexfile.write(head1 + style_fn + head2 + body1)
+ sortedtargetdir = os.listdir(targetdir)
+ sortedtargetdir.sort()
+ sortedtargetdir.reverse()
+ for file in sortedtargetdir:
+ sizestr = ""
+ # If showsize is 1 we have some filesdir and want to see the size of a file
+ if not re.match("^\.", file) and not file == indexfilename:
+ if showsize == 1:
+ size = os.lstat(targetdir + file).st_size
+ if size > 100000000000:
+ sizestr = str(int(size / 1073741824)) + " GiB"
+ elif size > 100000000:
+ sizestr = str(int(size / 1048576)) + " MiB"
+ elif size > 10000:
+ sizestr = str(int(size / 1024)) + " KiB"
+ else:
+ sizestr = str(size) + " B"
+ else:
+ entryname = re.sub(".html$", "", file)
+ # entryname = re.sub(".html$", "", re.sub("[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-2][0-9]:[0-6][0-9] ", "", file))
+
+ line = str('' + entryname + " | " + sizestr + " |
")
+ dirindexfile.write(line)
+ linecounter += 1
+
+ dirindexfile.write(foot)
+ return linecounter
+
+
+# Dig the files-directory and generate an index.
+linecounter = mkdirindex(targetdir, indexfilename, targetdirheadline, showsize)
+print("Dirindex in ", targetdir, " has ", linecounter, "lines")
+
+# Have a nice time.