Click here to Skip to main content
15,667,885 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am developing a Document management system( c#) in which users can create a folder structure which gets created within the application itself and details of the folder such as name and relative path get stored in the database table (for recovery purposes).
The only issue that i am facing is that when users create many folders and many sub folders and then move any of the folder which has sub folders under it the relative path of the sub folder under the moved folder doesn't change because i am not able to update it. I need a solution as to how do i recursively change the path of the sub folders under the root folder which get moved.

-root folder1
|-sub folder1
|-sub folder2
|-sub folder2-1
|-sub folder2-2
|-sub folder3
|-sub folder3-1
|-sub folder3-2
|-sub folder3-3
-root folder2
|-sub folder1
|-sub folder2
|-sub folder2-1
|-sub folder2-2

Say sub folder2 which is under root folder2 gets moved to sub folder 3-3
I am able to update the relative path in the database table of the sub folder2 but not the relative path of the sub folders under it.

Kindly suggest an solution.
Updated 31-Jan-16 15:05pm
Sergey Alexandrovich Kryukov 31-Jan-16 21:34pm    
What's wrong with just reading original MSDN documentation?

1 solution

Share this answer
Christopher Fernandes 31-Jan-16 22:59pm    
I am able to move the folders and sub folders to the new folder and maintain the correct folder structure in the new location. As i said i want to update the relative path in the database table which i guess i have to do by using recursion.
Sergey Alexandrovich Kryukov 31-Jan-16 23:41pm    
Do you mean updating the path string in a database? But how can it be a problem? It's your database...
Recursively? Why? You just change the string...
Christopher Fernandes 31-Jan-16 23:43pm    
Yes, exactly. i cannot update the path string for the subfolders under the root folder which gets moved to a new location.
Sergey Alexandrovich Kryukov 31-Jan-16 23:47pm    
Well, why can't you? What's the difference if you move something? You still know all paths.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900