Iterate through a Directory

Is there a way to open a directory and iterate through its files?

Is this an Asterisk question?

Yes. I am looking for a dial plan function to read the contents of a directory. I cant seem to find one. The best thing I can come up with is calling ‘ls -1 > FILE’ within SHELL and then reading the file which is super super ugly.

Maybe an AGI would make sense.

Walk through the directory, set a channel variable or two (dozen?) and ‘Bob’s your uncle.;’

Yes, this would be better handled by an AGI or ARI script than directly in the dialplan.

PHP scandir() function with AGI

Thanks for the advice guys!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.