cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete All Files Regardless of File Attributes

Delete All Files Regardless of File Attributes

Summary

Delete All Files Regardless of File Attributes

Synopsis

The DeleteDirectory InstallScript function deletes a directory even if it has read only, hidden, or system files.


Discussion

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;

Additional Information

For more information, see InstallShield Help Library topics:

? FindFile
? SetFileInfo
? DeleteFile

Was this article helpful? Yes No
100% helpful (1/1)
Comments

Nice and Helpfull articles

Version history
Last update:
‎Oct 02, 2007 05:25 PM
Updated by: