Question:Certkiller.com has asked you to create an application to display all of the top directories based
on the drive
path.
You need to ensure that the application displays the number of files within top-level directories.
What should you do? - (VB.NET) 

A Use the following code:
Public Sub DisplayDriveDirectories(drivePath As String)
If Directory.Exists(drivePath) Then
For Each dirPath As [String] In Directory.GetDirctories(drivePath)
Dim dir As New DirectoryInfo(drivePath)
Dim numFiles As Integer = dir.TotalFiles
Console.WriteLine("{0} : {1} files.", dir.Name, numFiles)
Next
End If
End Sub 

B Use the following code:
Public Sub DisplayDriveDirectories(drivePath As String)
If Directory.Exists(drivePath) Then
For Each dirPath As [String] In Directory.GetDirctories(drivePath)
Dim dir As New DirectoryInfo(drivePath)
Dim numFiles As Integer = dir.Length
Console.WriteLine("{0} : {1} files.", dir.Name, numFiles)
Next
End If
End Sub 

C Use the following code:
Public Sub DisplayDriveDirectories(drivePath As String)
If Directory.Exists(drivePath) Then
For Each dirPath As [String] In Directory.GetDirctories(drivePath)
Dim dir As New DirectoryInfo(drivePath)
Dim numFiles As Integer = dir.GetFiles().Length
Console.WriteLine("{0} : {1} files.", dir.Name, numFiles)
Next
End If
End Sub 

D Use the following code:
Public Sub DisplayDriveDirectories(drivePath As String)
If Directory.Exists(drivePath) Then
For Each dirPath As [String] In Directory.GetDirctories(drivePath)
Dim dir As New DirectoryInfo(drivePath)
Dim numFiles As Integer = dir.Size
Console.WriteLine("{0} : {1} files.", dir.Name, numFiles)
Next
End If
End Sub 

+ Answer
+ Report
Total Preview: 884

Copyright © 2024. Powered by Intellect Software Ltd