RE: How can I figure out whether it is binary file or ASCII file under one directory?
On Thu, 10 Oct 2002 [EMAIL PROTECTED] wrote: > Like .bin, .exe files, The format of the file is binary instead of ASCII. > > Thanks > > Lixin > > -Original Message- > From: Stovall, Adrian M. [mailto:Adrian.Stovall@;durez.com] > Sent: Thursday, October 10, 2002 2:06 PM > To: [EMAIL PROTECTED] > Subject: RE: How can I figure out whether it is binary file or ASCII > file under one directory? > > > Can you be any more specific than "various binary files"? > > -Original Message- > From: [EMAIL PROTECTED] [mailto:Cai_Lixin@;emc.com] > Sent: Thursday, October 10, 2002 12:54 PM > To: [EMAIL PROTECTED]; > [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: How can I figure out whether it is binary file or ASCII file > under one directory? > > > Dear all, > > A question, How can I figure out whether it is binary file or ASCII file > under one directory using perl? Does perl have a function for that? I > have a project to pick up various binary files from some directories. > The file test operators that I nebtioned previously can sometimes cause confusion. For example, it is entirely possible that a .pdf file can consist of nothing but ascii text characters however that doesn't mean that trying to print it out with NotePad will look very pretty. The use of the -T operator should not be relied on if the file's extention tells you something else. [EMAIL PROTECTED] All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How can I figure out whether it is binary file or ASCII file under one directory?
Why not use the -B operator to test the file for binary contents? if( -B $file) { # file is binary } else { # file is not binary } Carter. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, October 10, 2002 10:54 AM > To: [EMAIL PROTECTED]; > [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: How can I figure out whether it is binary file or ASCII file > under one directory? > > > Dear all, > > A question, How can I figure out whether it is binary file or > ASCII file > under one directory using perl? Does perl have a function for > that? I have a > project to pick up various binary files from some directories. > > Thanks in advance! > Have a nice day! > > Lixin > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How can I figure out whether it is binary file or ASCII file under one directory?
Given a filename, use the -B or -T operators. See perldoc ferlfunc HTH Stacy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 1:34 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: How can I figure out whether it is binary file or ASCII file under one directory? Like .bin, .exe files, The format of the file is binary instead of ASCII. Thanks Lixin -Original Message- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: RE: How can I figure out whether it is binary file or ASCII file under one directory? Can you be any more specific than "various binary files"? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:54 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: How can I figure out whether it is binary file or ASCII file under one directory? Dear all, A question, How can I figure out whether it is binary file or ASCII file under one directory using perl? Does perl have a function for that? I have a project to pick up various binary files from some directories. Thanks in advance! Have a nice day! Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How can I figure out whether it is binary file or ASCII file under one directory?
Like .bin, .exe files, The format of the file is binary instead of ASCII. Thanks Lixin -Original Message- From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: RE: How can I figure out whether it is binary file or ASCII file under one directory? Can you be any more specific than "various binary files"? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:54 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: How can I figure out whether it is binary file or ASCII file under one directory? Dear all, A question, How can I figure out whether it is binary file or ASCII file under one directory using perl? Does perl have a function for that? I have a project to pick up various binary files from some directories. Thanks in advance! Have a nice day! Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How can I figure out whether it is binary file or ASCII file under one directory?
Can you be any more specific than "various binary files"? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:54 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: How can I figure out whether it is binary file or ASCII file under one directory? Dear all, A question, How can I figure out whether it is binary file or ASCII file under one directory using perl? Does perl have a function for that? I have a project to pick up various binary files from some directories. Thanks in advance! Have a nice day! Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs