If you want to make the tree command available on mac OS X, run brew install tree
.
Simply, change BASE_DIR
and OUTPUT_JSON_FILENAME
.
Run convert-file-tree-json.py
.
You can use the tree command which lists a directory structure recursively.
e.g)
.
├── Adam\ Drive
│ ├── 103.815038-1.3362878.jpg
│ └── 103.815246-1.336219.jpg
├── Adam\ Park
│ ├── 103.813987-1.328999.jpg
│ └── 103.814129-1.329334.jpg
├── Adam\ Road
│ ├── 103.8134801-1.3241393.jpg
│ └── 103.813994-1.3284652.jpg
└── Adis\ Road
├── 103.847286-1.300006.jpg
└── 103.847336-1.2999752.jpg
The output *.json
might be :
{
"name": "images-new",
"type": "directory",
"children": [
{
"name": "Adam Park",
"type": "directory",
"children": [
{
"name": "103.813987-1.328999.jpg",
"type": "image"
},
{
"name": "103.814129-1.329334.jpg",
"type": "image"
}
]
},
{
"name": "Adam Road",
"type": "directory",
"children": [
{
"name": "103.813994-1.3284652.jpg",
"type": "image"
},
{
"name": "103.8134801-1.3241393.jpg",
"type": "image"
}
]
},
{
"name": "Adam Drive",
"type": "directory",
"children": [
{
"name": "103.815038-1.3362878.jpg",
"type": "image"
},
{
"name": "103.815246-1.336219.jpg",
"type": "image"
},
]
},
{
"name": "Adis Road",
"type": "directory",
"children": [
{
"name": "103.847286-1.300006.jpg",
"type": "image"
},
{
"name": "103.847336-1.2999752.jpg",
"type": "image"
}
]
}
]
}