in scandir filelist moved into while()