To Kill a Folder you can use the RmDir command, unfortunately this is a remnant of the Old BASIC command based on DOS and now superceded by VB.NET and Scripting such as File System and WMI.
Using the RMDIR command won't work on a Dir that has files in them.
Instead try one of the following
<pre>Sub RemoveDir_WithFiles()
<FONT COLOR="#00007F">Dim</FONT> objFso <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">On</FONT> <FONT COLOR="#00007F">Error</FONT> <FONT COLOR="#00007F">GoTo</FONT> DelErr
<FONT COLOR="#007F00">'CAUTION: Will delete entire Folder NO PROMPT</FONT>
<FONT COLOR="#00007F">Set</FONT> objFso = CreateObject("Scripting.FileSystemObject")
<FONT COLOR="#007F00">'// delete subfolders of MyDir</FONT>
objFso.DeleteFolder "C:\MyDir\*", <FONT COLOR="#00007F">True</FONT>
<FONT COLOR="#00007F">Exit</FONT> <FONT COLOR="#00007F">Sub</FONT>
DelErr:
MsgBox Err.Number & vbCr & _
Err.Description
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
<FONT COLOR="#00007F">Sub</FONT> DeleteFolder()
<FONT COLOR="#007F00">'// An error occurs if you try to use RmDir on a directory or folder containing files.</FONT>
<FONT COLOR="#007F00">'// Use the Kill statement to delete all files before attempting to remove a directory or folder</FONT>
<FONT COLOR="#007F00">'// <FONT COLOR="#00007F">Error</FONT> 75 Path/File access <FONT COLOR="#00007F">Error</FONT></FONT>
RmDir "C:\MyDir"
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
<FONT COLOR="#00007F">Sub</FONT> Tester()
Shell "command.com /c md C:\MyDir"
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
<FONT COLOR="#00007F">Sub</FONT> WMI_DeleteFolder()
<FONT COLOR="#00007F">Dim</FONT> strComputer <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">String</FONT>
<FONT COLOR="#00007F">Dim</FONT> strFolderToRemove <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">String</FONT>
<FONT COLOR="#00007F">Dim</FONT> objWMIService <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> colFolders <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> objFolder <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> Ret <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Long</FONT>
strComputer = "."
<FONT COLOR="#007F00">'// Note use of // forward slash</FONT>
strFolderToRemove = "C:\\MyDir\\New Folder"
<FONT COLOR="#00007F">Set</FONT> objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
<FONT COLOR="#00007F">Set</FONT> colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where Name = <FONT COLOR="#007F00">'" & strFolderToRemove & "'")</FONT>
<FONT COLOR="#00007F">For</FONT> Each objFolder In colFolders
objFolder.Delete
<FONT COLOR="#00007F">Next</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
</pre>