This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.
Private Sub findPSTButton_Click(sender As Object, e As EventArgs) Handles findPSTButton.Click
BackupperProgress.Value = 0
MasterTimer.Start()
Try
For Each foundPST As String In My.Computer.FileSystem.GetFiles(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, "*.pst")
PSTList.Items.Add(foundPST)
Next
Catch ex As Exception
End Try
BackupperProgress.Value = 99
End Sub
Do more with
PSTList.Items.Add(foundPST)
To this
PSTList.Items.AddRange(foundPST.ToArray())
Private Sub findPSTButton_Click(sender As Object, e As EventArgs) Handles findPSTButton.Click
Dim dirs As Object
dirs = My.Computer.FileSystem.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))
For Each dir As String In dirs
Try
For Each foundPST As String In My.Computer.FileSystem.GetFiles(dir, FileIO.SearchOption.SearchAllSubDirectories, "*.pst")
PSTList.Items.Add(foundPST)
Next foundPST
Catch ex As Exception
End Try
Next dir
End Sub
Imports System.IO
Imports System.Environment
Public Class Form1
Private Sub findPSTButton_Click(sender As Object, e As EventArgs) Handles findPSTButton.Click
Dim dirstack As New Stack(Of String)
Dim res As New List(Of String)
dirstack.Push(GetFolderPath(SpecialFolder.UserProfile))
Do While (dirstack.Count > 0)
Dim dir As String = dirstack.Pop
Try
res.AddRange(Directory.GetFiles(dir, "*.pst"))
For Each subdir As String In Directory.GetDirectories(dir)
dirstack.Push(subdir)
Next subdir
Catch ex As UnauthorizedAccessException
End Try
Loop
For Each fil As String In res
PSTList.Items.Add(fil)
Next fil
MsgBox(PSTList.Items.Count & " PST files found.")
End Sub
End Class
Premium Content
You need an Expert Office subscription to comment.Start Free Trial