update code to use SplFileInfo and SplFileObject