Folder checking

Joined
Jan 14, 2009
Messages
2
Reaction score
0
Hi all,

I wonder if you can help. I am using the code below to check a folder for a string. I will then rename the 08's to 09. The code works, but I need it to do the subfolders of the subfolders of the subfolders and so on... ie all levels in the directory.

Can anyone help please?



Code:
Sub ProcessOneFolder()
	
	Set FSO = CreateObject("Scripting.FileSystemObject")
	Set TopFolder = FSO.GetFolder("G:\A FSE Reports - All Regions\2009")

	For Each Folder In TopFolder.subfolders
		Debug.Print Folder
		If InStr(1, Folder, "08", vbTextCompare) > 1 Then
			Debug.Print "yes"
		End If

	Next Folder

End Sub
 
Back
Top