directory recursive delete problem on Windows

Andrew Tween amtween at hotmail.com
Tue Aug 28 20:00:52 UTC 2007


I should have mentioned that SHFileOperation will remove a folder AND its contents in one operation. There is no need to delete the folder's contents first. 
Also, when setting the folders files to not read-only; this is done RECURSIVELY. 
i.e. the folder's files, + the folder's child folders' files, + the folder's folders' folders' files etc..
 
Depending on the flags used, this operation may NOT put the deleted folder into the recycle bin. So beware, it can instantly remove a large chunk of your disk if you get the folder path wrong ! 
 
Cheers,
Andy


From: amtween at hotmail.comTo: squeak-dev at lists.squeakfoundation.orgDate: Tue, 28 Aug 2007 20:28:01 +0100Subject: RE: directory recursive delete problem on Windows


I have also seen this problem on Windows.>From what I remember, disabling the windows indexing service + any virus checkers + Google desktop search, made it happen less often :) Also, it was more likely to occur when an explorer, viewing the folders contents, was open.And, from what I recall, it was made worse if the folder contained a .thumbs file and so it happened more often on XP than on Win2000. In the end we solved the problem by using the Shell.dll function - SHFileOperation - with the FO_DELETE , FOF_NOERRORUI, FOF_SILENT, FOF_NOCONFIRMATION flags; to do the folder delete. We also removed any read only, archive, flags from the files in the folder before calling the function). You could probably use FFI to call the function, or else make a plugin.Cheers,Andy.

> Date: Tue, 28 Aug 2007 19:20:54 +0200> From: michael at impara.de> To: squeak-dev at lists.squeakfoundation.org> Subject: directory recursive delete problem on Windows> > Hi all,> > Grit just ran into an -interesting to say the least- problem with > recursive deletion of directories on Windows. We are not able to provide > a stripped down test case yet, but here some info:> > - we extract a zip archive to provide an initial setup for Plopp data> - then the user can play around in demo mode (problem doesn't occur in a > full version as the deletion doesn't take place)> - upon quitting demo mode all data is erased via a recursive directory > delete> > > We have simple test up without running the UI to reproduce the problem.> > The delete fails about 1 in 10 with a primitive failed in deleteDirectory.> > There are no open files or anything obvious.> > Now the interesting part...> If we add a delay of 1 sec after catching the error and then simply > retry the exception to delete the directory again, it works.> > [Painter3DStorage storageDirectory recursiveDelete]> on: Error> do: [: exception |> (Delay forMilliseconds: 1000) wait.> exeption retry]> > Any ideas?> > Michael> > > 

Email straight to your blog, upload jokes, photos and more. Windows Live Spaces, it's FREE! 
_________________________________________________________________
Try Live.com - your fast, personalised homepage with all the things you care about in one place.
http://www.live.com/?mkt=en-gb  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070828/d32daea0/attachment.htm


More information about the Squeak-dev mailing list