美文网首页
python 查找大文件

python 查找大文件

作者: SkTj | 来源:发表于2019-11-21 10:05 被阅读0次

import os

root="D:\"
def get_FileSize(filePath):
try:
fsize = os.path.getsize(filePath)
fsize = fsize/float(1024*1024)
return round(fsize,2)
except:
return 0
for r,dirs,files in os.walk(root):
for file in files:
name=os.path.join(r,file)
size=get_FileSize(name)
if size>500:
print(name,size)

相关文章

网友评论

      本文标题:python 查找大文件

      本文链接:https://www.haomeiwen.com/subject/yhuzictx.html