Converted to scandir, first working Windows version