0

Hi guys,
i have about 500 folder and each folder has 2 text files.I need to insert all those files in database.Right now my program has to read each and every folder, is there any other alternative to this.
Thanks

2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by sadhawan
0

Your problem looks like the classic trick question: "What is the time complexity of printing a binary search tree?". It is a trick question because "everyone knows" that binary search trees are have logarithmic complexity, but to print all of the nodes in the tree, the algorithm still has to visit all of the nodes. So the complexity is linear.

Likewise, if you need to insert all files into the data base and the files are spread across 500 folders, you still need to check every folder. The best you can get is a linear traversal of the folders.

0

wow!!! thanks so i am stuck for this stupid thing for days.

0

> so i am stuck for this stupid thing for days.
Enumerating folders is easy in C#. Just call Directory.GetDirectories().

0

i tried that , it gives me error , access to the directory path denied

0

Then you probably don't have the necessary permissions to read from the folders. Try running the program as a user with sufficient rights.

0

how can we get rights.These folders are in a cd.I have no idea how to do it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.