Search for AVI file?

John Doe joe at schmoe.com
Tue Aug 31 00:12:34 CEST 2004


On Mon, 30 Aug 2004 22:12:04 +0200, Peter Kleiweg
<in.aqua.scribis at nl.invalid> wrote:

>John Doe schreef:
>
>> I realise that this is not really a python question, but python's the
>> only language I'd be comfortable trying to deal with this.
>>
>> What I need is to search a drive and find all the AVI format files
>> that are NOT listed with the AVI extension.  I'm looking over an old
>> drive of mine from an old computer.  I know the files were renamed
>> with the wrong extension, but I know that they were originally AVI
>> files.  Can python do this for me?  Any hints?  Anybody have a link to
>> something that would already do this?  I appreciate any help.
>
>Use walk() to find all files. Open each file and read in the
>first 12 bytes. The last four of those 12 bytes should be
>'AVI ', if I'm not mistaken.

Ah, os.walk() was exactly what I needed.  By the time I read your
response, I had found the 'AVI' signature, but did not know an easy
way to get to all those files.  

Thank You.



More information about the Python-list mailing list