mbrofi.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:scripts 作者: mbfraga 项目源码 文件源码
def add_file(self, filepath, misc_prop=None):
        """Manually add files to the files list, and get all its file
        properties.

        Keyword arguments:
        filepath -- path to file
        misc_prop -- add a miscellaneous property
        """
        if not os.path.isfile(filepath):
            print(filepath + " is not a file.")
            return
        fp_rel = filepath[self.__path_len:]

        try:
            stat = os.stat(filepath)
        except:
            return
        file_props = {}
        file_props['size'] = stat[ST_SIZE]
        file_props['adate'] = stat[ST_ATIME]
        file_props['mdate'] = stat[ST_MTIME]
        file_props['cdate'] = stat[ST_CTIME]
        file_props['name'] = fp_rel
        file_props['fullpath'] = filepath
        file_props['misc'] = misc_prop

        self.__files.append(file_props)
        self.__filecount += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号