It should I will look at it later. I am not at home so I cannot test it.
Take a look at this and post the Debug information.
js code:
RemoveDirectory('C:\\This\\Is\\The\\Directory\\To\\Delete\\');
function RemoveDirectory(sPath) {
var WIN32_FIND_DATA = Interop.Allocate(592);
var hSearch = Interop.Call('kernel32', 'FindFirstFileW', sPath+'*', WIN32_FIND_DATA);
var hResult = -1;
while(hResult != 0){
if(!(WIN32_FIND_DATA.ReadDWORD(0) & 0x10 /* FILE_ATTRIBUTE_DIRECTORY */)){
Interop.Call('kernel32', 'DeleteFileW', '\\\\?\\'+sPath+WIN32_FIND_DATA.ReadString(44));
} else {
RemoveDirectory(sPath+WIN32_FIND_DATA.ReadString(44));
if ( Interop.Call('kernel32', 'RemoveDirectoryW', '\\\\?\\'+sPath+WIN32_FIND_DATA.ReadString(44)) === 0 ) TraceWin32Error()
}
hResult = Interop.Call('kernel32', 'FindNextFileW', hSearch, WIN32_FIND_DATA)
}
Interop.Call('kernel32', 'FindClose', hSearch);
}
function TraceWin32Error(){
var LastError = Interop.GetLastError();
if(LastError != 0) {
var MsgBuffer = Interop.Allocate(1024);
Interop.Call("Kernel32", "FormatMessageW", 0x1000, 0, LastError, 0, MsgBuffer, 1024, 0);
Debug.Trace(MsgBuffer.ReadString(0));
}
}