Copy an hierarchy..

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jac0bz1
Forum Newbie
Posts: 1
Joined: Tue May 11, 2010 7:46 am

Copy an hierarchy..

Post by jac0bz1 »

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..
Post Reply