This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- Delete All Files Regardless of File Attributes
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
Delete All Files Regardless of File Attributes
Delete All Files Regardless of File Attributes
Summary
Delete All Files Regardless of File AttributesSynopsis
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;
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:
100% helpful
(1/1)
Comments
Jul 18, 2019
07:39 AM
Nice and Helpfull articles