If you're just interested in enumerating files, [man]glob/man is often far easier to use. Otherwise, the answer to your question is most likely yes, it's certainly possible. Things that might not make this possible would be intentional restrictions such as open_basedir.
What have you tried?