#35, use file.list() instead of listFiles() to limit memory consumption