<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def files(self):
 """ Get a generator that yields all files in the directory. """

        filelist_p = new_gp_object("CameraList")
        lib.gp_camera_folder_list_files(self._cam._cam, self.path.encode(),
                                        filelist_p, self._cam._ctx)
        for idx in range(lib.gp_list_count(filelist_p)):
            fname = get_string(lib.gp_list_get_name, filelist_p, idx)
            yield File(name=fname, directory=self, camera=self._cam)
        lib.gp_list_free(filelist_p)