#coding=gb2312
#!/usr/bin/python
import os
import sys
import os.path
from shutil import copy
for dirpath,dirnames,filenames in os.walk("f:/"):
for filename in filenames:
if os.path.splitext(filename)[1] == ".txt":
filepath = os.path.join(dirpath,filename)
print filepath
copy(filepath,"F:/test/"+filename)
Python 查找指定目录下.txt文件并移动到指定目录
最新推荐文章于 2024-02-06 14:52:24 发布