Solved

Retrieving Drives and Folder Structure in highly efficient manner

Posted on 2011-09-20
4
304 Views
Last Modified: 2012-06-22
We desire to get all the drives and folders off a server, but afraid of the processing (CPU) power that will be used.   Is there a way to only go get the drives/folder one time, then only get them again if something has changed to avoid using up so much CPU.  Also, is there a way to export out the folder structure to an xml list so we can insert it into an SQL server with a data type of xml?

we are using vb.net (vs 2010) if anyone desires to show code.   One note, we are NOT interested in getting any files, just the drives and folders

thanks
0
Comment
Question by:rkneal
  • 2
4 Comments
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 36573196
Use Linq to do that. It best way to do this
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36576337
When you say folders, do you mean all folders/subfolders within drives?
0
 

Author Comment

by:rkneal
ID: 36578076
yeah, we want to retrieve all drives, folders, subfolders but NO file names and write them to an XML file.
taking up as little CPU is important. If there is a way to know something changed to drive, folder, subfolders so don't have to keep doing it, that would be even better but if not would settle for most efficient way to do it.  Sounds like Linq would be best, but any samples would really be appreciated!
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 36582385
The basic method that you can use is Directory.GetDirectories. It would return you a list of all the folders and subfolders within a path (such as C).

http://msdn.microsoft.com/en-us/library/c1sez4sc.aspx

Also
http://www.devsource.com/c/a/Languages/Recursive-Directory-Searches-in-C-Part-1/
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Query Syntax Error 9 34
Library to convert HTML to PDF. 8 46
Round a string to two digits 12 25
affinity mask in sql server 1 8
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now