Storing of folder structure in SQL DB

Sergei Minayev sergei.minayev at gmail.com
Thu Apr 5 07:58:22 EDT 2007


Hi All!
Can you please help me with the following problem:
I need to store a copy of local folders structure in MySQL database.
I have chosen the following table structure for that:
------------------------------------------------
|  id  |  id_uplink  |  folder_name  |
------------------------------------------------
id - unique property of each folder.
id_uplink - id of upper level folder is stored here (for example: if
id of c:\test is 1, than id_uplink of c:\test\python equals 1).
folder_name - name of folder.
You see, i dont want to store the path list, but the structure.

The question is how to implement that in Python. I easily made it in C+
+ using recursion. But, unfortunately, I can't figure it out how to
make it in python using os.walk function (or can you recommend smth.
else???). :( Though it looks quite simple, but anyway.

Best Regards,
Segei




More information about the Python-list mailing list