Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60841 > unrolled thread

Checking Common File Types

Started byjade <jadec375@msn.com>
First post2013-12-01 18:27 +0000
Last post2013-12-01 18:27 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Checking Common File Types jade <jadec375@msn.com> - 2013-12-01 18:27 +0000

#60841 — Checking Common File Types

Fromjade <jadec375@msn.com>
Date2013-12-01 18:27 +0000
SubjectChecking Common File Types
Message-ID<mailman.3444.1385934912.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Hello, 
I'm trying to create a script that checks all the files in my 'downloaded' directory against common file types and then tells me how many of the files in that directory aren't either a GIF or a JPG file. I'm familiar with basic Python but this is the first time I've attempted anything like this and I'm looking for a little help or a point in the right direction? 

file_sigs = {'\xFF\xD8\xFF':('JPEG','jpg'),  '\x47\x49\x46':('GIF','gif')}
def readFile():    filename = r'c:/temp/downloads'      fh = open(filename, 'r')     file_sig = fh.read(4) print '[*] check_sig() File:',filename #, 'Hash Sig:', binascii.hexlify(file_sig) 
RegardsJade



 
  		 	   		  

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web