and determine if theyre a file or a folder?

by most efficeint, i mean fastest with least ram needed (so no giant controls to add, etc)