From: George Malamidis Date: 2007-06-19T17:01:55+09:00 Subject: Re: Check for text file Hello, On a *nix system, you can do file_type = `file my_file` puts file_type but this will not work on Windows. George On 19 Jun 2007, at 08:33, Alin Popa wrote: > Alin Popa wrote: >> Alex Young wrote: >>> Alin Popa wrote: >>>> Hi guys, >>>> >>>> After some research I still cannot find a way how to see if a >>>> file is >>>> plain text or binary. In fact I want to check if a file is plain >>>> text no >>>> matter what characters are in it. >>>> This thing may be possible by using ruby ? >>> >>> I think so, but it's a little unclear exactly what you're trying to >>> achieve. Do you have an example? >> >> I'm trying to do a replace in file for some text but I don't want to >> consider files like archives or other binary files. > > Of course, when I'm on windows I can go after the file extension > and try > to ignore some specific (eg. .exe, .zip, .jar, .rar, .anything_i_want) > but I don't know how to do it on Linux/Unix OS where file extension is > not mandatory. > > -- > Posted via http://www.ruby-forum.com/. >