<div class="meta" robots="noindex">

</div>

Method

# FolderItem.Item

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `FolderItem.ChildAt<folderitem.childat>` as a replacement.

</div>

## Description

If this **FolderItem** is a directory, *Index* is an element in a one-based array of FolderItems in this directory.

## Notes

<div class="note">

<div class="title">

Note

</div>

If you want to iterate over the contents of a directory, make sure to *always* do this starting at index 1, then increasing the index up to the value of FolderItem.Count. Avoid iterating backwards (using a `For...Next</api/language/loops/for...next>` loop with DownTo or Step -1), because that can potentially become extremely slow with larger directories, especially on macOS. To see how to delete the contents of a folder, see the example in `FolderItem.Remove<folderitem.remove>`.

</div>

Be aware that the returned FolderItem object may be *nil*, e.g. if current file permissions deny access to it.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Alias resolution

If the FolderItem is an Alias, <span class="title-ref">Item</span> automatically resolves the Alias and returns a FolderItem for the original file, folder, or application.

If necessary, macOS will mount external volumes and may present a login dialog during alias resolution. Be aware that this can lead to network accesses when macOS tries to automatically resolve the Alias, with long timeouts before the <span class="title-ref">Item</span> function returns with an error when the destination is not reachable. Therefore, on macOS, in most cases, you rather should use `FolderItem.ChildAt<folderitem.childat>`, then test the returned <span class="title-ref">Item</span>'s Alias property and only then consider resolving it later:

``` xojo
item = item.Parent.Child(item.Name)
```

and stop doing this if you encounter an error, giving the user a chance to gracefully exit any loops.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Performance considerations

Avoid calling this function several times as it is costly in processing time. If you need to get several properties of an <span class="title-ref">Item</span>, get it once and store it in a variable of type FolderItem, then access that variable instead.

## Sample code

This example puts the names of all the items on the Desktop that are stored on the boot volume into ListBox1.

``` xojo
Dim itemIdx, dirCount As Integer
Dim dir, item As FolderItem
dir = SpecialFolder.Desktop
dirCount = dir.Count
For itemIdx = 1 To dirCount
  item = dir.Item(itemIdx)
  If item <> Nil Then
    ListBox1.AddRow(item.Name)
  End If
Next
```

## Compatibility

All project types on all supported operating systems.
