if I do
rm_rf('somewhere')
mkdir('somewhere')
every so often, the mkdir
throws a Permission Denined
. Is this because the rm_rf
runs asynchronously and sometimes hasnt finished deleting the dir before the mkdir
runs?
How do I make it block until its completed the delete?
running this on Windows btw.
Thanks
Sounds like a feature of NTFS, see Microsoft Suppport:
This file is in a state known as pending deletion. This file has been deleted, but there are still handles open to it. NTFS will wait until all handles to this file are closed before updating the index. If an attempt is made to access the file, however, NTFS will deny the attempt. Because the file is listed in the index, but is effectively deleted, you can see the file but you cannot access it.
And looking at the solutions, I don't think there is much to do other than to wait and retry.