Consider there is a file with the name "test.txt" and it has below file structure (refer to the image attached) red indicates folders and blue indicates files. Now is it possible to write a code to identify parent nodes and child nodes and assign values to each node in a way that it specifies who is the parent?
My database structure: Here id is an auto_increment value, where the title can be a folder name or a file name (that is a parent and child node names), and parent_id is the foreign key that refers to the id.
CREATE TABLE category (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
title varchar(255) NOT NULL,
parent_id int(10) unsigned DEFAULT NULL,
PRIMARY KEY (id),
FOREIGN KEY (parent_id) REFERENCES category (id)
ON DELETE CASCADE ON UPDATE CASCADE);