Jump to content


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.
Photo

Deleting readonly files n directories


2 replies to this topic

smm

smm
  • Members
  • 10 posts

Posted 16 January 2006 - 16:54

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? smile.gif

smm

smm
  • Members
  • 10 posts

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;

antyagi

antyagi
  • Full Members
  • 121 posts

Posted 17 January 2006 - 05:07

You are writing InstallScript and posting ni Platform SDK section ?? ohmy.gif

by-the-way, in Platform SDK your can use RemoveDirectory/DeleteFolder.
  ankur tyagi