Solved

Retrieving Drives and Folder Structure in highly efficient manner

Posted on 2011-09-20
4
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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