Delete a folder
Posted 06 November 2003 - 23:43
I am trying to delete afolder using the following script
prototype DeleteDirectory(STRING); //accepts a directory path
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
My directory has some subdirectoryies in it.
I have been finding a way to delte the folder which has some files and subdirectories.It's not delteing it, unles I explicitly remove the read only attribute in the top level folder.
Please let me now if there is work around.
Posted 07 November 2003 - 01:08
Yes, that's a known limitation with DeleteFile/DeleteDir which is why I see you followed the IS Knowledge Base Article Q105082. However, as you discovered that only covers read-only files & not read-only folders.
To workaround the problem though, I would try creating a batch to do the delete and then simply call it from your InstallScript.
Oh, and in the future, I don't suggest installing read-only files/folders unless absolutely necessary for just this reason.
Edited by Taco Bell, 07 November 2003 - 01:09.
Posted 07 November 2003 - 17:40
Thanks for your reply,
No this folder is the Back up folder which is the copy of our stuff from the previous install.
Can you please let me know how to call the Batch files to delete a folder and the folder name is set via IS script.
Posted 08 November 2003 - 01:46