Search for AVI file?
John Lenton
john at grulic.org.ar
Mon Aug 30 16:31:57 EDT 2004
On Mon, Aug 30, 2004 at 10:12:04PM +0200, Peter Kleiweg 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.
Correct. According to file(1)'s database, there are two types of AVI:
0 string RIFF RIFF (little-endian) data
[...]
>8 string AVI\040 \b, AVI
[...]
0 string RIFX RIFF (big-endian) data
[...]
>8 string AVI\040 \b, AVI
(meaning that little-endian AVIs start with 'RIFFAVI ', whereas
big-endian start with 'RIFXAVI ').
HTH
--
John Lenton (john at grulic.org.ar) -- Random fortune:
BOFH excuse #10:
hardware stress fractures
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20040830/2628d70a/attachment.sig>
More information about the Python-list
mailing list