The link in my signature provides many good examples. Some using the Dir() method and some using API.
Forum Rules