Copy an hierarchy..
Posted: Tue May 11, 2010 7:52 am
I'm having a problem with a "sort-of-filesystem" in MySql..
I store fileinformation in a database so that I don't need to create folders and so that I can hide filenames..
The problem comes when i need to copy and hierarchy..
i.e:
id | dir | filname
1 | -1 | Main dir
2 | 1 | Subfolder of "Main dir"
3 | 1 | filename.txt
4 | 2 | Subfolder of "Subfolder of "Main dir""
No let's say i want to copy "Main dir".. then i need to copy that, the files it contain (id: 2 and 3) and the folder that the subfolders has..
It's not a problem copy them like they are, but they need to have the right dir-id after the copy..
I store fileinformation in a database so that I don't need to create folders and so that I can hide filenames..
The problem comes when i need to copy and hierarchy..
i.e:
id | dir | filname
1 | -1 | Main dir
2 | 1 | Subfolder of "Main dir"
3 | 1 | filename.txt
4 | 2 | Subfolder of "Subfolder of "Main dir""
No let's say i want to copy "Main dir".. then i need to copy that, the files it contain (id: 2 and 3) and the folder that the subfolders has..
It's not a problem copy them like they are, but they need to have the right dir-id after the copy..