Cannot delete folder within script
Forums
Hi Brian,
I'm writing a script that creates a working folder, does a lot of file compilation within that folder, and then moves the resulting two files to a new folder.
Once the results are moved to the new folder I then want to delete the working folder.
As part of the main subroutine I have the folder name defined much earlier in the script as shown below
Set fldrName as String
Set wD as String
wD= CurDir()
fldrName = "CRISP WORKING FOLDER"
However, the following extract from the script keeps returning an error saying the folder doesn't exist.
Function DeleteCrispWorkingFolder(wD As String, errSwitch As Boolean)
If errSwitch = 0 Then On Error GoTo ErrHandler
Dim task As Object
Dim errMsg As String
Client.CloseAll
Set task = Client.ProjectManagement
task.DeleteFolder wD & "\CRISP WORKING FOLDER"
Set task = Nothing
Client.RefreshFileExplorer
Exit Function
ErrHandler:
If Client.ErrorCode > 0 Then
errMsg = "Error: " & Client.ErrorString
MsgBox errMsg, MB_OK, "IDEAScript Error"
Client.Quit
Else
errMsg = "Error # " & Str(Err.Number) & Chr$(13) & Err.Description & Chr$(13)
MsgBox errMsg, MB_OK, "IDEAScript Error"
Client.Quit
End If
End Function
Any help would be greatly appreciated.
Thanks a million,
Phil
Hi Brian,
Hi Brian,
That worked perfectly.
Thanks so much as I've another working folder in the script that I'll need to remove later on.
I definitely owe you a few pints.
All the best,
Phil