This item was deprecated in version 2019r2. Please use FolderItem.ChildAt as a replacement.
If this FolderItem is a directory, Index is an element in a one-based array of FolderItems in this directory.
TrueItem returns the actual FolderItem, even if it is an Alias or Shortcut. To get the FolderItem pointed to by the alias/shortcut, use FolderItem.ChildAt.
You can also use code like this to look up the destination file:
item = item.Parent.Child(item.Name)
Be aware that the returned FolderItem object may be nil, e.g. if current file permissions deny access to it.
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 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.
Avoid calling this function several times as it is costly in processing time. If you need to get several properties of an item, get it once and store it in a variable of type FolderItem, then access that variable instead.
This example populates a ListBox with the TrueItem elements of the user's Desktop directory.
Dim dir As FolderItem = SpecialFolder.Desktop Dim dirCount As Integer = dir.Count For itemIdx As Integer = 1 To dirCount Dim item As FolderItem = dir.TrueItem(itemIdx) If item <> Nil Then ListBox1.Addrow(item.Name) End If Next
All project types on all supported operating systems.