I need to delete directories containing readonly files. I am using the DeleteDir function. But it fails and it leaves out the files contained in the directory.
Could anyone plz propose a solution?
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Deleting readonly files n directories
Started by
smm
, Jan 16 2006 16:54
2 replies to this topic
Posted 16 January 2006 - 17:09
//--------------------------------------------------------------------------
// Function: DeleteDirectory
// Purpose: Deletes a directory even if it has readonly files
//--------------------------------------------------------------------------
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
// Purpose: Deletes a directory even if it has readonly files
//--------------------------------------------------------------------------
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;
Posted 17 January 2006 - 05:07
You are writing InstallScript and posting ni Platform SDK section ??
by-the-way, in Platform SDK your can use RemoveDirectory/DeleteFolder.
by-the-way, in Platform SDK your can use RemoveDirectory/DeleteFolder.
ankur tyagi