What about for f.Count downto 1 instead of for i = 1 to f.Count?
--- On Tue, 3/31/09, Kimball Larsen <kimball@kimballlarsen.com> wrote:
> From: Kimball Larsen <kimball@kimballlarsen.com>
> Subject: FolderItem.delete Oddities?
> To: "REALbasic NUG" <realbasic-nug@lists.realsoftware.com>
> Date: Tuesday, March 31, 2009, 11:09 AM
> Has anyone noticed any problem with folderitem.delete where
> it deletes some files, but not others?
>
> Here's the background: I'm trying to empty a
> directory that I created to hold some temporary images.
> Here is the code I'm using to delete:
>
> dim f as FolderItem =
> specialFolder.Temporary.child("ah")
> dim f2 as folderItem
> dim i as integer
> for i = 1 to f.Count
> f2 = f.item(i)
> f2.Delete
> next
> f.delete
>
> Prior to the delete, the directory contains the following
> files:
>
> bottle101.png
> bottle202.png
> bottle207.png
> bottle404.png
> facts101.png
> facts202.png
> facts207.png
> facts404.png
> bottle102.png
> bottle204.png
> bottle302.png
> bottle502.png
> facts102.png
> facts204.png
> facts302.png
> facts502.png
> bottle105.png
> bottle205.png
> bottle304.png
> bottle508.png
> facts105.png
> facts205.png
> facts304.png
> facts508.png
> bottle201.png
> bottle206.png
> bottle402.png
> bottle510.png
> facts201.png
> facts206.png
> facts402.png
> facts510.png
>
> After the delete, it contains these:
> bottle102.png
> bottle206.png
> bottle402.png
> bottle508.png
> facts201.png
> facts302.png
> facts404.png
> facts510.png
> bottle201.png
> bottle302.png
> bottle404.png
> bottle510.png
> facts204.png
> facts304.png
> facts502.png
> bottle204.png
> bottle304.png
> bottle502.png
> facts102.png
> facts206.png
> facts402.png
> facts508.png
>
> So, it's deleting some of them, but not all.
>
> What gives?
>
>
> - Kimball
> http://www.kimballlarsen.com
>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|