<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_file_metadata(self, fname):

 """
 collects the files metadata - note that this will fail
 with strange errors if network connection drops out to
 shared folder, but it is better to stop the program
 rather than do a try except otherwise you will get an
 incomplete set of files.
 """


        file_dict = {}
        file_dict["fullfilename"] = fname
        try:
            file_dict["name"] = os.path.basename(fname)
            file_dict["date"] = self.GetDateAsString(fname)
            file_dict["size"] = os.path.getsize(fname)
            file_dict["path"] = os.path.dirname(fname)
        except IOError:
            print('Error getting metadata for file')

        self.fl_metadata.append(file_dict)