Search for AVI file?

Peter Kleiweg in.aqua.scribis at nl.invalid
Mon Aug 30 16:23:05 EDT 2004


Peter Kleiweg schreef:

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

Or from the command line:

find / -type f -exec file '{}' ';' | grep AVI



-- 
Peter Kleiweg  L:NL,af,da,de,en,ia,nds,no,sv,(fr,it)  S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html




More information about the Python-list mailing list