1
Answer

Need help in writing algorithm for runtime folder creation

Sumit Kumar

Sumit Kumar

15y
3.9k
1
Hi all,
I have very  tricky problem which you u all might have seen in your daily life when u r creating the folder.Suppose i want to create folder in D drive. right click and select new folder like this i want to create n no of folders. Then the series will be Newfolder,Newfolder(2),Newfolder(3),Newfolder(4),
Newfolder(5),Newfolder(6),Newfolder(7)...After creating if i delete say Newfolder(3),Newfolder(4) and again if i create Newfolder index will be Newfolder(3),then one more create index will be Newfolder(4),create one more folder index will be Newfolder(8).....etc.
This problem i would like  to be done in programatic way in c sharp code behind page. So pls somebody can write the algorithm for this problem. From TextBox Folder Name can be entered and result will be shown in Treeview in the form of Tree. Ex.Enter parent folder name as Sumit hit the AddFolder Button result will be in treeview like...
-Root
         -Sumit
Now select Sumit and enter many folder name with name Newfolder...index will  automatically increment then it should look like this...
-Root
        -Sumit
                Newfolder
                Newfolder(2)
                Newfolder(3)
                Newfolder(4)
And if i want to delete any particular folder,select the folder and hit the Delete folder button.After deletation if i want to create the samefolder with same name index shoud follow the rules which i explained above.Hope i explained my problem.Pls somebody solve this problem.

Your reply is highly appreciated.
Thanks,
Sumit
Answers (1)