FolderItems Count

Hello to everyone, I want to get the count of all the FolderItems “.txt” which are in a specific folder. Any help? Thanks in advance!

Have a look at the documentation for FolderItem

[code] dim f As FolderItem
dim dlg as new SelectFolderDialog
dim count as integer

f = dlg.ShowModal
if f <> nil and f.Exists Then
for i as integer = 1 to f.count
if right(f.item(i).name, 4) = “.txt” then
count = count + 1
end if
next
MsgBox str(count)
end if[/code]

If you give a man a fish…

and sometimes when you attempt to teach a man to fish, he just gets tangled in the line, and gets the hook caught in his hair :slight_smile:

some people can’t fish
some people shouldn’t fish
and they should rely on a person who can fish to get fish

enough with the analogy

I do try to steer people to try & use the docs, examples etc before asking on the forum
Being resourceful and knowing where to look and even possibly what to look for is, IMHO, a good trait to have as a programmer

Thanks all to answer! I will try in a few minutes

With shell?

[code]~ ioannis$ time find /Users/ioannis/Documents -not -type d | egrep -v ‘\.txt$’ | wc -l
36553 //<<<< txt files

real 0m0.852s
user 0m0.073s
sys 0m0.813s
ioanniss-imac:~ ioannis$[/code]
alternate

find . -name "*.filetype" | wc -l

Moral of the story: first get a haircut and a bodygroom before starting to fish :smiley: .