Okay, so I have a structure which can look like this
d
├── a
│ ├── f_2
│ └── f_3
├── b
│ ├── f
│ │ └── f_5
│ └── f_4
├── c
└── f_1
But there can be a lot of sub-folders and files. However, in the database they are stored as: (id, parent_id, type, name)
where type is the file/folders id, parent_id is the parent folder, type tells if the entry is a file or folder, and name is an ASCII string representing the name of the folder/file.
What I want to do is being able to give an id of any folder in the tree, let us say in this case d
and I want to select ids of all files and folder which are children of the folder d
include their sub children.
I have looked through the mySQL documentation on hierarchical structures but I cannot see a solution based on this.