Determine file type (binary or text)

Sami Viitanen none at
Thu Aug 14 10:13:00 CEST 2003

Thanks for the answers.

To be more specific I'm making a script that should
identify binary files as binary and text files as text.

The script is for automating CVS commands and
with CVS you have to add the -kb flag to
add (or import) binary files. (because it can't itself
determine what type the file is). If binary file is not
added with -kb the results are awful.

Script example usage: <directory_name>

Script makes list of all files under that directory
and then determines each files filetype. After that
all files are added with Add command and binary
files get that additional -kb automatically.

"Sami Viitanen" <none at> wrote in message
news:AFm_a.9725$g4.189983 at
> Hello,
> How can I check if a file is binary or text?
> There was some easy way but I forgot it..
> Thanks in adv.

More information about the Python-list mailing list