B
brian
I created a piece of code that I run through a macro in
Access 2000. It takes 13 file extensions and goes
through the folders and deletes files with that
extension. I have the extensions in one array called
Extensions(13) and the Folders to search through in
another array called Folders(3).
Currently for each file extension the search needs to go
through the entire folder. For example: I have a folder
called 2003. There are 14 file extensions. Each file
extension searches through the Folder. So the folder
gets searched 14 times for file extensions.
I need help restructuring this piece of code to that when
the program looks at a file it searches all 14 file
extensions in the Extension() array.
For example: The file is called 'test.gvx' I want the
code to take that file and search every index of the
array for a match.
I have 4 folders to
search and each folder is about 10 gigs. These are all
files that get created with our engineering program when
the engineering .dwg file is opened.
Thanks for your help. If anyone needs more clarification
please feel free to ask or email me at (e-mail address removed)
Function SimpleSearchTest()
Dim Extensions(15) As String
Dim i As Integer
Extensions(0) = "*.bak"
Extensions(1) = "*.txt"
Extensions(2) = "*.gbcx"
Extensions(3) = "*.run"
Extensions(4) = "*.ord"
Extensions(5) = "*.nte"
Extensions(6) = "*.asc"
Extensions(7) = "*.bc2"
Extensions(8) = "*.gpf"
Extensions(9) = "*.trc"
Extensions(10) = "*.err"
Extensions(11) = "*.tmp"
Extensions(12) = "*.vib"
Extensions(13) = "*.zip"
MsgBox ("Begin")
For i = 0 To UBound(Extensions)
' Perform simple search using the FileSearch object.
Dim varFile As Variant
With Application.FileSearch
.NewSearch
.FileName = Extensions(i)
.LookIn = "j:\2002\"
.Execute
.SearchSubFolders = True
For Each varItem In .FoundFiles
Debug.Print varItem
Kill (varItem)
Next varItem
End With
Next
MsgBox "end"
End Function
Access 2000. It takes 13 file extensions and goes
through the folders and deletes files with that
extension. I have the extensions in one array called
Extensions(13) and the Folders to search through in
another array called Folders(3).
Currently for each file extension the search needs to go
through the entire folder. For example: I have a folder
called 2003. There are 14 file extensions. Each file
extension searches through the Folder. So the folder
gets searched 14 times for file extensions.
I need help restructuring this piece of code to that when
the program looks at a file it searches all 14 file
extensions in the Extension() array.
For example: The file is called 'test.gvx' I want the
code to take that file and search every index of the
array for a match.
I have 4 folders to
search and each folder is about 10 gigs. These are all
files that get created with our engineering program when
the engineering .dwg file is opened.
Thanks for your help. If anyone needs more clarification
please feel free to ask or email me at (e-mail address removed)
Function SimpleSearchTest()
Dim Extensions(15) As String
Dim i As Integer
Extensions(0) = "*.bak"
Extensions(1) = "*.txt"
Extensions(2) = "*.gbcx"
Extensions(3) = "*.run"
Extensions(4) = "*.ord"
Extensions(5) = "*.nte"
Extensions(6) = "*.asc"
Extensions(7) = "*.bc2"
Extensions(8) = "*.gpf"
Extensions(9) = "*.trc"
Extensions(10) = "*.err"
Extensions(11) = "*.tmp"
Extensions(12) = "*.vib"
Extensions(13) = "*.zip"
MsgBox ("Begin")
For i = 0 To UBound(Extensions)
' Perform simple search using the FileSearch object.
Dim varFile As Variant
With Application.FileSearch
.NewSearch
.FileName = Extensions(i)
.LookIn = "j:\2002\"
.Execute
.SearchSubFolders = True
For Each varItem In .FoundFiles
Debug.Print varItem
Kill (varItem)
Next varItem
End With
Next
MsgBox "end"
End Function