C0d3M0nk3y
Member
- Joined
- May 6, 2011
- Messages
- 10
- Programming Experience
- Beginner
Hello, I'm new to the forum and new to VB.Net. I am trying to create a small application that will pull values from a config file (which is working) and then based on those values will search through directories recursively for files with specified extensions. In the end I would like these files deleted but I also need to have the app write a list of each file that is successfully delted to a .log file.
Here is what I have so far, the values from the config file are successfully being passed to the sub routine however nothing is ever written to the .log file.
Sub activeRecursive(ByVal activeStat As String, ByVal rootDirectory As String, ByVal fileExtension As String, ByVal maxAge As Int32)
If Not Directory.Exists(rootDirectory) Then
End If
Dim tmpFile As String = "C:\Files.log"
Dim objWriter As New StreamWriter(tmpFile)
Dim allFiles() As FileInfo
Dim dirInfo As DirectoryInfo
dirInfo = New DirectoryInfo(rootDirectory)
allFiles = dirInfo.GetFiles(fileExtension, SearchOption.AllDirectories)
For Each File In allFiles
objWriter.Write(allFiles)
'IO.File.Delete(fileNames)
Next File
objWriter.close
End Sub
Thanks in advance for the help!
Here is what I have so far, the values from the config file are successfully being passed to the sub routine however nothing is ever written to the .log file.
Sub activeRecursive(ByVal activeStat As String, ByVal rootDirectory As String, ByVal fileExtension As String, ByVal maxAge As Int32)
If Not Directory.Exists(rootDirectory) Then
End If
Dim tmpFile As String = "C:\Files.log"
Dim objWriter As New StreamWriter(tmpFile)
Dim allFiles() As FileInfo
Dim dirInfo As DirectoryInfo
dirInfo = New DirectoryInfo(rootDirectory)
allFiles = dirInfo.GetFiles(fileExtension, SearchOption.AllDirectories)
For Each File In allFiles
objWriter.Write(allFiles)
'IO.File.Delete(fileNames)
Next File
objWriter.close
End Sub
Thanks in advance for the help!