I am thinking this might work (Think of groups as folders);
type group
parent as integer
name as string
active as integer
entry as string[]
endtype
groups as group[]
So it works like this
parent Points to the index of the parent group in the groups table
name Is the name of the group (Folder name)
active Tells us that the group is either active or deleted (You cannot physically remove something from the groups table because it will corrupt the pointers). You could have a table of inactive groups that you re-use
entry Is an array of each entry in the group (Files/folders in the folder)
An
entry can contain the name of a nuclear element (or filename) or the name of a group (or folder) . A group name is followed by the "|" character and a number which is the index of the group in the groups table for this group (This simulates recursion). You could use GetStringToken() to extract it
Technically you should never find an inactive group because you would traverse the table from the first entry and if an entry was deleted you would remove the parent reference as well