Tip of the day: Folderitem items sorted
Function Items(extends f as FolderItem, IncludeInvisible as Boolean = true) As FolderItem()
// return all items in a folder
// resoloves aliases or links
// optionally filters hidden files
Dim items() As FolderItem
Dim c As Integer = f.Count
For i As Integer = 1 To c
Dim item As FolderItem = f.Item(i)
If item <> Nil Then
If IncludeInvisible Or item.Visible Then
items.Append item
end if
End If
Next
Return items
End Function
Function ItemsSorted(extends f as FolderItem, IncludeInvisible as Boolean = true) As FolderItem()
// return all items in a folder ordered by display name
// resoloves aliases or links
// optionally filters hidden files
Dim items() As FolderItem
dim names() As string
Dim c As Integer = f.Count
For i As Integer = 1 To c
Dim item As FolderItem = f.Item(i)
If item <> Nil Then
If IncludeInvisible Or item.Visible Then
items.Append item
names.Append item.DisplayName
end if
End If
Next
names.SortWith items
Return items
End Function
Function TrueItems(extends f as FolderItem, IncludeInvisible as Boolean = true) As FolderItem()
// return all true items in a folder
// does not resolove aliases or links
// optionally filters hidden files
Dim items() As FolderItem
Dim c As Integer = f.Count
For i As Integer = 1 To c
Dim item As FolderItem = f.TrueItem(i)
if item <> nil then
If IncludeInvisible Or item.Visible Then
items.Append item
end if
end if
Next
Return items
End Function
Function TrueItemsSorted(extends f as FolderItem, IncludeInvisible as Boolean = true) As FolderItem()
// return all true items in a folder ordered by display name
// does not resolove aliases or links
// optionally filters hidden files
Dim items() As FolderItem
dim names() As string
Dim c As Integer = f.Count
For i As Integer = 1 To c
Dim item As FolderItem = f.TrueItem(i)
If item <> Nil Then
If IncludeInvisible Or item.Visible Then
items.Append item
names.Append item.DisplayName
end if
End If
Next
names.SortWith items
Return items
End Function