Experts Exchange connects you with the people and services you need so you can get back to work.
' Define the folder to scan, and the age of files to locate
strBaseDir = "D:\Client FTP Folders"
datBefore = CDate("11/03/2013 7:32:24 PM")
' Create a dictionary to hold the list of extensions to list
Set dicExt = CreateObject("Scripting.Dictionary")
dicExt.CompareMode = vbTextCompare
dicExt.Add "ord", 0
' Set up filesystem object for usage
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Look for files
' Subroutine (recursive) to search for files to delete
On Error Resume Next
' Look at all files in this folder
For Each objFile In objFolder.Files
' Make sure it's one of the extensions we want to delete
If dicExt.Exists(objFSO.GetExtensionName(objFile.Path)) Then
' See if it's old enough to display
If objFile.DateCreated < datBefore Then
WScript.StdOut.WriteLine objFile.Path & ", " & objFile.DateCreated
' See if we were able to access this folder, if not don't recurse into it
If Err.Number = 0 Then
' Recursively drill down into subfolder
For Each objSubFolder In objFolder.SubFolders
Open in new window
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim path As String = "C:\\temp"
Dim topdir As New IO.DirectoryInfo(path)
Dim fileList As New List(Of FileInfo)
For Each file As FileInfo In fileList
Debug.WriteLine(file.FullName & " / " & file.LastWriteTime.ToLongDateString)
Sub findFileInfosRecursively(ByVal dir As IO.DirectoryInfo, ByVal fileList As List(Of FileInfo))
Dim files() As FileInfo = dir.GetFiles("*.log")
For Each afile As FileInfo In files
If afile.LastWriteTime < New Date(2013, 7, 1) Then
Dim dirs() As DirectoryInfo = dir.GetDirectories
For Each adir As DirectoryInfo In dirs
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $122.40.
Premium members get this course for $151.20.
Premium members get this course for $159.20.
Premium members get this course for $329.00.
Premium members get this course for $79.20.
Premium members get this course for $108.00.