#-*- 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的更多相关文章

  1. 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 ...

  2. [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 ...

  3. Linux From Scratch(从零开始构建Linux系统,简称LFS)- Version 7.7(一)

    一. 准备工作 1. 需要一个Linux宿主系统,例如早先版本的 LFS,Ubuntu/Fedora,SuSE 或者是在你的架构上可以运行的其它发行版 如果想实现Win7与Linux双系统,可参考我的 ...

  4. 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 ...

  5. 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 ...

  6. (copy) Top Ten Reasons not to use the C shell

    http://www.grymoire.com/Unix/CshTop10.txt ========================================================== ...

  7. cygwin 安装apt-cyg命令

    googlecode关闭了.没法用wget安装apt-cyg 找了半天只有github里有个方法可行: apt-cyg is a simple script. To install: lynx -so ...

  8. RASPBERRY PI 外设学习资源

    参考: http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html Raspberry Pi         Get st ...

  9. Raspberry Pi UART with PySerial

    参考:http://programmingadvent.blogspot.hk/2012/12/raspberry-pi-uart-with-pyserial.html Raspberry Pi UA ...

随机推荐

  1. Issue 7: 网络in action

    网络运维基础 基础参数 配置:IP,子网掩码,网关,dns服务器,dhcp服务器 基础应用 在网关设置上搭建VPN组网 改host文件 单台主机原则上只能配置一个网关 协议 协议是全球都遵守的一套编码 ...

  2. iar调试

    我们可以自己建立自己的工程了,但这一步只是开发中的第一小步.今天就来说说开发中举足轻重的另外一件事:调试. 其实调试本身也并不难,楼主总结,调试关键在于两件事,一是运行,二是观察,为了更好的实现这两者 ...

  3. Leetcode: Find Leaves of Binary Tree

    Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves ...

  4. poj 3262 Protecting the Flowers

    http://poj.org/problem?id=3262 Protecting the Flowers Time Limit: 2000MS   Memory Limit: 65536K Tota ...

  5. Word2013中制作按钮控件

    1.由于“开发工具”不经常用,所以在功能选项面板中没有“开发工具”这一栏.所以我们需要设置.在功能选项面板中选择“文件”,在跳转出来的版面中选择“选项”.

  6. Overview of the Oppia codebase(Oppia代码库总览)

    Oppia is built with Google App Engine. Its backend is written in Python, and its frontend is written ...

  7. 响应式内容滑动插件jQuery.bxSlider

    bxSlider特性 1.充分响应各种设备,适应各种屏幕: 2.支持多种滑动模式,水平.垂直以及淡入淡出效果: 3.支持图片.视频以及任意html内容: 4.支持触摸滑动: 5.支持Firefox,C ...

  8. 关于spark的一些简单认识。

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博客地址为http://www.cnblogs.com/jasonnode/ . 网站上有对应每 ...

  9. hsql数据库使用详解(入门)及快速使用

    一.简介: hsql数据库是一款纯Java编写的免费数据库,许可是BSD-style的协议,如果你是使用Java编程的话,不凡考虑一下使用它,相对其 他数据库来说,其体积小,才563kb.仅一个hsq ...

  10. ZwQuerySystemInformation 安全使用心得 Delphi 版

    作为 DELPHI 版本,需要引用 jwaNative, JwaWinType ,他们是 JEDI API 的一部分.JEDI 官网有下载. 先给出 2 个辅助函数 和 一些结构体. type     ...