B
brian
I have a VB app that searches 5 directories from the
root.
For example:
Function PurgeJobFiles()
Dim db As Database, rs As Recordset
Const OMNIchrd_PATH = "N:\OMNIchrd\"
On Error Resume Next
Set db = DBEngine.Workspaces(0).Databases(0)
Set rs = db.OpenRecordset("qryDelete_Shop_File",
DB_OPEN_DYNASET) ' Create dynaset.
rs.MoveFirst ' Move to first record.
If Err <> 0 Then
rs.Close ' Close recordset
On Error GoTo 0 ' Reset error processing
Exit Function ' Exit
End If
Do Until rs.EOF ' Loop until no matching
records.
Kill OMNIchrd_PATH & rs!JOB_NO & "*.*" '
Delete OMNI files.
rs.MoveNext ' Move to next record.
Loop ' End of loop.
MsgBox "Files have been deleted", vbOKOnly, "Deleted
Files"
rs.Close ' Close recordset
On Error GoTo 0 ' Reset error processing
End Function
This deletes every record in the root directory that
matches the query. I have been given a new task to
search directories with sub directories within
subdirectories. Is there a dynamic way of searching
through the root directory and hit all the sub
directories?
Thanks
root.
For example:
Function PurgeJobFiles()
Dim db As Database, rs As Recordset
Const OMNIchrd_PATH = "N:\OMNIchrd\"
On Error Resume Next
Set db = DBEngine.Workspaces(0).Databases(0)
Set rs = db.OpenRecordset("qryDelete_Shop_File",
DB_OPEN_DYNASET) ' Create dynaset.
rs.MoveFirst ' Move to first record.
If Err <> 0 Then
rs.Close ' Close recordset
On Error GoTo 0 ' Reset error processing
Exit Function ' Exit
End If
Do Until rs.EOF ' Loop until no matching
records.
Kill OMNIchrd_PATH & rs!JOB_NO & "*.*" '
Delete OMNI files.
rs.MoveNext ' Move to next record.
Loop ' End of loop.
MsgBox "Files have been deleted", vbOKOnly, "Deleted
Files"
rs.Close ' Close recordset
On Error GoTo 0 ' Reset error processing
End Function
This deletes every record in the root directory that
matches the query. I have been given a new task to
search directories with sub directories within
subdirectories. Is there a dynamic way of searching
through the root directory and hit all the sub
directories?
Thanks