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 ...
随机推荐
- scrollViewDidEndScrollingAnimation和scrollViewDidEndDecelerating的区别
#pragma mark - 监听 /** * 点击了顶部的标题按钮 */ - (void)titleClick:(XMGTitleButton *)titleButton { // 修 ...
- Trace-如何跟踪某个Job的开销
1.背景 下面是从以往Profiler收集的跟踪文件中提取Job有关数据 ;with cte as( Duration_ms ,CPU CPU_ms,Reads,Writes,StartTime,En ...
- 2.C语言中的关键字
1.auto 修饰局部变量,编译器默认所有局部变量都是用auto来修饰的,所以在程序中很少见到. 2.static 它作用可大了,除了可以修饰变量,还可以修饰函数,修饰变量,改变其作用域和生命周期,修 ...
- .NET client connection Limit
调试出了一个诡异的问题,使用多个进程没问题,单进程出现了. fix: //默认限制为2个连接 //public const int DefaultPersistentConnectionLimit = ...
- react lazyload
思路: DOM加载时,<img> 标签里,添加data-src路径 = src 路径, src路径 = 本地默认图片路径, DOM加载完成后,监听页面可视区域,有data-src时,就将s ...
- 用Canvas制作剪纸效果
在做剪纸效果之前,先介绍剪纸效果运用到的一些知识: 1.阴影: 在Canvas之中进行绘制时,可以通过修改绘图环境中的如下4个属性值来指定阴影效果: shadowColor:CSS格式的颜色字串.默认 ...
- poj 1266 Cover an Arc.
http://poj.org/problem?id=1266 Cover an Arc. Time Limit: 1000MS Memory Limit: 10000K Total Submiss ...
- 纪勇破解QQ号问题
试题描述 来到了新学校,才相处不到一个月,jy就对oyjy一见钟情.于是向oyjy问QQ号.当然身为创(实)新(验)一班的同学,oyjy还是要考考jy.她给了纪勇一个加密后的QQ号,让纪勇解密,解密规 ...
- jQuery File Upload done函数没有返回
最近在使用jQuery File Upload 上传图片时发现一个问题,发现done函数没有callback,经过一番折腾,找到问题原因,是由于dataType: ‘json’造成的,改为autoUp ...
- hadoop的学习
http://www.aboutyun.com/thread-6179-1-1.html