python移动指定文件夹指定类型文件

python 移动文件python

利用python写一些简单的脚本整理程序,为生活服务是一个目标code

这个程序就是为了移动指定文件下的指定类型的文件到目标文件下utf-8

# -*- coding: utf-8 -*-

import os
import sys
import shutil

print 'move vedio into the sure  folder'

# set  the file position where to move 

#须要移动的文件的原路径
orgin_path = '/Users/wqp/Downloads/'

#移动的文件的目标路径
target_path =  '/Users/wqp/Downloads/youtube/'

#移动的文件类型 这是个tuple
file_type =('.mp4','.rmvb','.MP4','RMVB')

for file in  os.listdir(orgin_path):
	if file.endswith(file_type):
		shutil.move(orgin_path+file,target_path)
相关文章
相关标签/搜索