PYTHON实现将一个文件夹下的名字满足条件的图片拷贝复制到另一个文件夹路径
2017-06-18 11:10
811 查看
# -*- coding:utf8 -*- import os import shutil class BatchRename(): ''' 批量重命名文件夹中的图片文件 ''' def __init__(self): self.path = '/home/jinbeibei/File/bmw02' self.newpath='/home/jinbeibei/File/bmw02_' def tiqu(self): filelist = os.listdir(self.path) #print(filelist) #total_num = len(filelist) for file in filelist: #print file filedir=os.path.join(self.path,file) #print filedir (shotname, extension) = os.path.splitext(file) #print(shotname) if (int(shotname)>=1492894241301760000 and int(shotname) <=1492894306934685000) \ or (int(shotname)>=1492894317758476000 and int(shotname) <=1492894334900000000) \ or (int(shotname) >= 1492894360423125000 and int(shotname) <= 1492894371366133000) \ or (int(shotname) >= 1492894360423125000 and int(shotname) <= 1492894371366133000) \ or (int(shotname) >= 1492894379008616000 and int(shotname) <= 1492894391000000000) \ or (int(shotname) >= 1492894398867814000 and int(shotname) <= 1492894412045824000) \ or (int(shotname) >= 1492894422951426000 and int(shotname) <= 1492894439954311000) \ or (int(shotname) >= 1492894449889590000 and int(shotname) <= 1492894460617925000) \ or (int(shotname) >= 1492894476106229000 and int(shotname) <= 1492894484394109000) \ or (int(shotname) >= 1492894492780730000 and int(shotname) <= 1492894503758939000) \ or (int(shotname) >= 1492894509313996000 and int(shotname) <= 1492894528800847000) \ or (int(shotname) >= 1492894534387097000 and int(shotname) <= 1492894554262926000) \ or (int(shotname) >= 1492894563944744000 and int(shotname) <= 1492894571431244000) \ or (int(shotname) >= 1492894636159845000 and int(shotname) <= 1492894647300792000) \ or (int(shotname) >= 149289 bb54 4661917076000 and int(shotname) <= 1492894670584546000) \ or int(shotname) >= 1492894677779714000: print shotname #print(str(filedir)) shutil.copy(str(filedir),os.path.join(self.newpath,file)) if __name__ == '__main__': demo = BatchRename() demo.tiqu()
相关文章推荐
- matlab 根据一个目录下多个文件夹中的多个注释名字找个对应图片拷贝到另一个文件夹中
- javascript实现一个按钮,点击按钮拷贝电脑指定路径到u盘(并在U盘上创建新的文件夹)
- Java:使用I/O流操作将一个图片复制到另一个文件夹下后打不开的解决方法
- 实验 4.2.4 实现文件复制 1. 用文件流的 I/O 函数实现一个文件拷贝程序,将一个文件拷贝到另一个文件。 2. 分别用字节读,行读,任意大小读的方式。
- Python如何批量复制图片到另一个文件夹中
- QT下实现将图片从一个文件拷贝到另一个文件夹
- python---将一个文件夹下的图片移到另一个文件夹
- Python如何批量复制图片到另一个文件夹中
- [PHP][Function]实现将一个文件夹下的所有文件及文件夹复制到另一个文件夹里(保持原有结构
- python如何获取一个文件夹内包括子文件夹所有文件的名字和路径
- C# 实现:将一个文件夹下的.png图片全部移动到另一个文件夹
- c#实现将一个文件夹中的所有文件复制到另一个文件夹,并在新文件夹中创建一个txt文件记录copy的文件综述以及文件名称
- python随机选取10000张图片并复制到另一个文件夹中
- [PHP][Function]实现将一个文件夹下的所有文件及文件夹复制到另一个文件夹里(保持原有结构)[已验证][原创]
- Python 实现一个小功能: 删除某路径下文件及文件夹的脚本
- 用高效流,将一个图片复制到另一个路径
- java 把一个文件夹里图片复制到另一个文件夹里
- C# j基本操作-拷贝文件夹的所有内容到另一个文件夹内: 复制代码 1 public static void CopyDir(string srcPath, string实现文件夹的复制以及删除
- Python如何批量复制图片到另一个文件夹中
- python——将一个文件夹下各个子文件夹下的图片复制到一个新的文件夹中