#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import shutil
lowerSize = input("请输入需要筛选图片大小的最小阀值(单位KB):")
lowerSize = int(lowerSize)
fromFilePath = raw_input("请输入项目文件夹名称:")
fromFilePath = './' + fromFilePath
toFilePath = "./z_copy"
def main():
copyPic_with_size()
return
def copyPic_with_size():
num=0
totalSize=0
for root, dirs, files in os.walk(fromFilePath, topdown=False):
for name in files:
fileName, fileSuffix = os.path.splitext(name)
currentPath = root + '/' + name
size = os.path.getsize(currentPath)
toFullPath = toFilePath + root[len(fromFilePath):]
toFullName = toFullPath + '/' + name
if ( fileSuffix == '.png' or fileSuffix == '.jpg' ) and ( size > 1024*lowerSize ):
if not os.path.exists(toFullPath):
os.makedirs(toFullPath)
shutil.copy2(currentPath, toFullName)
print(currentPath[len(fromFilePath):]);
num=num+1
totalSize=totalSize+size
print('totalNum================================='),
print num
print('totalSize================================='),
print totalSize/1024.0
return
main()