Tool for creating a file that contains the contents and types of everything in the directory.
-d, --dryrun
- Run through the process without actually creating any new files-R, --recursive
- Recursively create listings for all subfolders-o, --output [name]
- Specify the name to use for the file output (default.listings.json
)-s, --sparse [depth]
- Create listings that only contains n [depth] of children (defaultnull
)-b, --basepath [root]
- Root for generated relativepath
(default'.'
)
mkdir tmp
touch tmp/test.txt
json-dir-listing tmp/
- Creates
tmp/.listings.json
containing
{
"path":"tmp",
"name":"tmp",
"type":"folder",
"children":[{
"path":"tmp/test.txt",
"name":"test.txt",
"type":"file"
}]
}
I wanted to create a dynamic client-only website as my personal CV/blog/whatever, but I didn't want it become bloated with the content itself so I decided to dynamically load and render all the content. The setup I was using doesn't allow directory listings, but allows file access so I created this to get a list of all files in a directory.