#-*- coding:utf-8 -*-
from PIL import Image
import os
import shutil
source_path=r"/home/song/桌面/newtest/origin"
long_path=r"/home/song/桌面/newtest/long"
thin_path=r"/home/song/桌面/newtest/thin"
files = os.listdir(source_path)
files.sort(key=lambda x: int(x.split('.')[0]))
for file in files:
img = Image.open(os.path.join(source_path,file))
width = img.size[0]
height = img.size[1]
if width == 480:
shutil.move(os.path.join(source_path,file),long_path)
if width == 321:
shutil.move(os.path.join(source_path,file),thin_path)