A simple script to get all pictures
#-*- coding:utf-8 -*-
import shutil
import os
from Tkinter import *
import time
import re def get_all_file(adr): all_adr=[]
all_dir.append(adr)
adr+='\\'
if os.path.exists(adr):
try:
all_adr=os.listdir(adr)
except Exception,e:
print e
for i in all_adr:
#print adr+i
if os.path.isfile(adr+i):
file.append(adr+i)
dict_file[adr+i]=str(int(get_file_size(adr+i))/1024)
if os.path.isdir(adr+i):
get_all_file(adr+i) def get_file_size(adr):
if os.path.isfile(adr):
return os.path.getsize(adr) def search_file(file,key):
search_result=[]
for f in file:
for k in key:
if k in f.lower():
print f
shutil.copyfile(f,'D:\\result\\'+os.path.basename(f))
search_result.append(f) return search_result if __name__=='__main__':
dict_file={}
adr='E:\\'
all_dir=[]
file=[]
get_all_file(adr)
with open(r'C:\Users\cchen\Desktop\allfile.txt','w+') as f:
for i in file:
#print i+'\t'+dict_file[i]
f.write(i+'\t'+dict_file[i]+'\n')
'''
for j in all_dir:
print j
''' search_key=['.jpg','.png','jpeg','gif','bmp'] with open(r'C:\Users\cchen\Desktop\searchfile.txt','w+') as sf:
for i in search_file(file,search_key):
print i+'\t'+dict_file[i]
sf.write(i+'\t'+dict_file[i]+'\n')
A simple script to get all pictures的更多相关文章
- Upgrade NE script with GUI but cannot support multithread, need to add soon
#-*- coding:utf-8 -*- __authour__='CC' from Tkinter import *import osimport telnetlibimport timeimpo ...
- [Notes] AWS Automation using script and AWS CLI
(c) 2014 Amazon Web Services, Inc. and its afflialtes, All rights reserved. The content in this file ...
- Linux From Scratch(从零开始构建Linux系统,简称LFS)- Version 7.7(一)
一. 准备工作 1. 需要一个Linux宿主系统,例如早先版本的 LFS,Ubuntu/Fedora,SuSE 或者是在你的架构上可以运行的其它发行版 如果想实现Win7与Linux双系统,可参考我的 ...
- How to step through your code in chrome
By executing code one line or one function at a time, you can observe changes in the data and in the ...
- test for cvx library in matlab - windows
Download the zip file of cvx http://cvxr.com/cvx/download/ by downloading cvx-w64.zip Require a lice ...
- (copy) Top Ten Reasons not to use the C shell
http://www.grymoire.com/Unix/CshTop10.txt ========================================================== ...
- cygwin 安装apt-cyg命令
googlecode关闭了.没法用wget安装apt-cyg 找了半天只有github里有个方法可行: apt-cyg is a simple script. To install: lynx -so ...
- RASPBERRY PI 外设学习资源
参考: http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html Raspberry Pi Get st ...
- Raspberry Pi UART with PySerial
参考:http://programmingadvent.blogspot.hk/2012/12/raspberry-pi-uart-with-pyserial.html Raspberry Pi UA ...
随机推荐
- layoutSubviews
- pypi上传库
把程序打包上传到PyPi版本库中 转自 1 首先必须要按照以下文件结构 ├── douban │ ├── cli.py │ ├── douban.py │ ├── douban_token ...
- XPath Axes(轴)
XML 实例文档 我们将在下面的例子中使用此 XML 文档: <?xml version="1.0" encoding="ISO-8859-1"?> ...
- (一)Nand FLASH 原理讲解
NAND FLASH 优势 : 可以用当硬盘 这里好像型号是 K9F2G08 基本结构: 不是很难自己看看,暂时不要看
- Java多线程开发系列之二:如何创建多线程
前文已介绍过多线程的基本知识了,比如什么是多线程,什么又是进程,为什么要使用多线程等等. 在了解了软件开发中使用多线程的基本常识后,我们今天来聊聊如何简单的使用多线程. 在Java中创建多线程的方式有 ...
- SQL语句处理一些修改、新增、删除、修改属性操作(MySql)
方法一: 直接(手动)去修改数据库名称,数据库表名称,数据库列名称.列属性 方法二: 使用SQL语句去修改 -- 修改表名 ALTER TABLE tableName RENAME newTableN ...
- Centos 6.5安装bugzilla 5.0.2
1. 下载bugzilla 下载地址:https://ftp.mozilla.org/pub/webtools/ 因为我在github上搜了一下“bugzilla cn”提示有中文语言包就下了5.0. ...
- EntityFramework Core技术线路(EF7已经更名为EF Core,并于2016年6月底发布)
官方文档英文地址:https://github.com/aspnet/EntityFramework/wiki/Roadmap 历经延期和更名,新版本的实体框架终于要和大家见面了,虽然还有点害羞.请大 ...
- Entity Framework7 有哪些不同?之具体功能
Entity Framework7 有哪些不同?之具体功能 前面我们介绍了关于EF7的新特性.开发计划和入门介绍.今天,我们来看看EF7的具体新功能及用法.本文中的环境,为EF7入门里介绍的环境. 1 ...
- Xcode插件描述
Xcode插件 Xcode是iOS的集成开发环境,虽然苹果一直在不断改进Xcode,但程序员总是有各种新奇的想法和需求,当Xcode无法满足他们时,于是他们就会通过插件的方式来为Xcode增加新的功能 ...