don't use recursive approach (heap issues) :) use a queue
queue.add(param_dir)
while (queue is not empty){
directory= queue.pop
- get items from current directory
- if item is file add to a list (final list)
- if item is directory => queue.push
}
that was easy, enjoy!