Trying to get a simple loop to nuke files with a certain extension. The following code errors out with file not found on the “Set f” line even though the file is definitely there.
Set fs = CreateObject(“Scripting.FileSystemObject”)
With Application.FileSearch
.FileName = “*.gid”
.LookIn = strDevelPath
.SearchSubFolders = True
.Execute
For i = 1 To .FoundFiles.Count
Set f = fs.GetFile(fs.GetFileName(.FoundFiles(i)))
If f.Attributes And 2 Then f.Attributes = f.Attributes – 2
If f.Attributes And 1 Then f.Attributes = f.Attributes – 1
Kill .FoundFiles(i)
Next
End With
Thanks for any input,
Chris