Solved

Retrieving Drives and Folder Structure in highly efficient manner

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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