Created: 2011-07-19 01:02
Updated: 2013-12-14 02:46

Generate a JSON representation of a given directory listing, like so:

$ imagedex -r -P repo ./ | python -mjson.tool
    "repo": [
            ".git": [
            "imagedex": [

Almost everything about the output is configurable via command line options.

$ imagedex -j jsonPcallBack -P repo ./ | python -mjson.tool
    "repo": [
        / * ... */

#Use: To see all available flags and options, run: -h

I run this script as a response to inotify events; only generating a .json file when something in the target directory supposedly changes. For a live example, see api_drawings script I run on my web server:

while inotifywait --excludei='.*.swp' -r -e modify /some/dir/; do
    imagedex -r -j callBack -p '/api/3/' -f /api/path/imagedex.json /some/dir


  • Write proper unit tests for all our little quirks


  • Be aware that the -r recursive option is a lie and only provides data for a single directory level down.
  • As this script is just a wrapper around the python module, simplejson it must be installed.
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more