Solved

Retrieving Drives and Folder Structure in highly efficient manner

Posted on 2011-09-20
4
308 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to restore or keep sql2000  backups useful... 2 28
SQL Server maintenance plan 8 53
SQL Recursion 6 33
VB.net Code to make a TaskPane float in Excel Add-in 2 25
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

740 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