The DeleteDirectory InstallScript function deletes a directory even if it has read only, hidden, or system files.
The following is the InstallScript code for DeleteDirectory:
prototype DeleteDirectory(STRING); //accepts a directory path function DeleteDirectory(directory) STRING fileName;
begin while ( FindFile(directory, "*.*", fileName)=0 ) //Finds all files in a directory SetFileInfo(directory^fileName, FILE_ATTRIBUTE, FILE_ATTR_NORMAL, ""); //resets files attributes to NORMAL DeleteFile(directory^fileName); //Delete File endwhile; DeleteDir(directory, ALLCONTENTS); end;
For more information, see InstallShield Help Library topics: