Re: binary or text file

From: Date: Thu, 06 Nov 2003 15:05:29 +0000
Subject: Re: binary or text file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-168733@lists.php.net to get a copy of this message
Pete -- ..and then pete M said... % % I'm doing a bit of data recovery using php as the scripting language.. How interesting. That's certainly a new twist. % % Is there a way to determine is a file is binary or text ? % all the files are recovered but the file names do not have extensions ! You could use file(1) to check. It looks at the first few bytes of a file and compares them against a table (usually in /etc/magic). % % eg chkdsk.exe would be dgfhgj5767363874 as a file name Of course, this implies that you're on a Windows box, which means getting your hands on file() would require a bit more work (but should go well with cygwin). % % pete HTH & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#168733) next »