I have been trying to write a sub which would look in a folder and delete only certain file types.
for example the folder would have three file types but I only want to get rid of 2.
I hav tried something like this.
Dim PathnameDGN
Dim PathnameDWG
PathnameDWG = DrgDest & "*.dwg"
PathnameDGN = DrgDest & "*.dgn"
Set ds = CreateObject("Scripting.FileSystemObject")
If Not ds.FileExists(PathnameDWG) Then
ds.DeleteFile (PathnameDGN)
Else
ds.DeleteFile (PathnameDWG)
End If
This partially works. Say if the folder contains dgn files it will work but not dwg files unless I switch them round in the code which defeats the object.
Is there a more defined way I can specify which filetypes are to be deleted.
Thansk
for example the folder would have three file types but I only want to get rid of 2.
I hav tried something like this.
Dim PathnameDGN
Dim PathnameDWG
PathnameDWG = DrgDest & "*.dwg"
PathnameDGN = DrgDest & "*.dgn"
Set ds = CreateObject("Scripting.FileSystemObject")
If Not ds.FileExists(PathnameDWG) Then
ds.DeleteFile (PathnameDGN)
Else
ds.DeleteFile (PathnameDWG)
End If
This partially works. Say if the folder contains dgn files it will work but not dwg files unless I switch them round in the code which defeats the object.
Is there a more defined way I can specify which filetypes are to be deleted.
Thansk