Archive: A problem when deleting a folder


A problem when deleting a folder
After I call rmdir /r to delete a folder, the folder is not removed. Then if I manaully delete this folder, it is gone. That means the folder is not held by anyone. So why isn't it removed initially?


Most often it is because some program (could even be your installer) has their current working directory on that folder. The installer current working directory is changed by using SetOutPath. Try setting the installer cwd to $Temp before doing the RmDir.


Originally posted by demiller9
Most often it is because some program (could even be your installer) has their current working directory on that folder. The installer current working directory is changed by using SetOutPath. Try setting the installer cwd to $Temp before doing the RmDir.
I will try what you suggested to see if I still have the same issue. Actually the issue that the folder is not removed doesn't happen every time. I am not sure whether it is caused by trying to remove a current working directory. Thanks.