I would like to store a JSON structure which holds projects and files I am currently working on. File structure looks like this:
|-project1
|--sequence1
|----file1.ext
|----file2.ext
|-project2
|--sequence1
|----file1.ext
|----file2.ext
|-project3
|--sequence3
|----file1.ext
|----file2.ext
JSON version would look like this:
data = [
{
type: "folder",
name: "project1",
path: "/project1",
children: [
{
type: "folder",
name: "sequence1",
path: "/project1/sequence1",
children: [
{
type: "file",
name: "file1.ext",
path: "/project1/sequence1/file1.ext"
} , {
type: "file",
name: "file2.ext",
path: "/project1/sequence1/file2.ext"
...etc
}
]
}
]
}
]
Is it possible to render this structure to actual directories and files using Python? (it can be empty files). On the other hand, I would like to build a function traversing existing directories, returning similar JSON code.