You can save the directory tree in one table using any SQL database, making the table self-referencing. A good example is the Windows Installer Directory table , where you will see this structure:
- Directory = primary key field, usually an integer
- Directory_Parent = field "foreign key", which indicates the identifier of another directory in the same table
- Value = string containing directory / folder name
A foreign key will be added to your file table that refers to the directory identifier. To find the full path, you must follow the chain and build a path from the end (right), linking each parent directory to the front (left). For example, the file will point to the directory identifier "4" with a subfolder of "Value", then you will get the parent value "folder", and then the parent value again until you reach the root, creating a path, for example /root/folder/subfolder/filename .
ewall
source share