Solved

Retrieving Drives and Folder Structure in highly efficient manner

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

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, …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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