#!/mod/bin/jimsh package require cgi puts "Content-Type: application/json" puts "" cgi_input #cgi_dump set _cgi(dir) "/media/My Video" set dir [dict get $_cgi dir] # Strip double slashes regsub -all -- {\/+} "$dir/*" "/" dir puts "{" foreach subdir [glob -nocomplain "$dir"] { set new 0 foreach hmt [glob -nocomplain "$subdir/*.hmt"] { puts "HMT: $hmt" } } puts "}"