Delete all imd files in a directory
Brian Element
This snippet of code will delete al the IDEA files in an IDEA project folder.
Snippet
Option Explicit
Sub Main
Call deleteAllIMDFiles()
End Sub
Function deleteAllIMDFiles()
Dim objFSO As Object
Dim objFolder As Folder
Dim objFile As File
Dim task As task
Set objFSO = CreateObject("Scripting.FileSystemObject")
'make sure the folder exists
If objFSO.FolderExists(Client.WorkingDirectory) Then
'get the folder information, namely all the files from the folder
Set objFolder = objFSO.GetFolder(Client.WorkingDirectory)
On Error Resume Next
'the ProjectManagement task contains the code to delete files in the project folder
Set task = Client.ProjectManagement
'loop through all the files in the folder
For Each objFile In objFolder.Files
'make sure the files is an IDEA file
If Right(UCase(objFile), 3) = "IMD" Then
'delete the file
task.DeleteDatabase objFile
End If
Next
End If
client.RefreshFileExplorer
Set task = Nothing
Set objFile = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
End Function