why "bad file descriptor"?

Discussion in 'Perl' started by Geoff Cox, Dec 4, 2005.

  1. Geoff Cox

    Geoff Cox Guest

    Hello,

    I have a few hundred zip files (each one has 1 MS Word doc in it) in
    the c:\docs folder

    I run the following script and get "bad file descriptor" after the
    first doc file has been created from the first zip file.

    Any ideas why?!

    Thanks

    Geoff

    #!perl
    use warnings;
    use strict;
    use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
    use File::Find;

    my $dir = 'c:/docs';

    find sub {
    my $name = $_;
    return if -d;
    my $zip = Archive::Zip->new();
    die "Error reading $name:$!" unless $zip->read("$name") == AZ_OK;
    $zip->extractTree();

    }, $dir;
    Geoff Cox, Dec 4, 2005
    #1
    1. Advertising

  2. Geoff Cox

    Geoff Cox Guest

    On Sun, 04 Dec 2005 19:56:20 +0000, Geoff Cox
    <> wrote:

    >Hello,
    >
    >I have a few hundred zip files (each one has 1 MS Word doc in it) in
    >the c:\docs folder
    >
    >I run the following script and get "bad file descriptor" after the
    >first doc file has been created from the first zip file.
    >
    >Any ideas why?!


    Solved this myself ! In fact the errors are due to the presence of
    either

    the obvious - a badly formed zip file

    or

    any other non-zip file ... I missed this one - stupid mistake.

    Cheers,

    Geoff












    >
    >Thanks
    >
    >Geoff
    >
    >#!perl
    >use warnings;
    >use strict;
    >use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
    >use File::Find;
    >
    >my $dir = 'c:/docs';
    >
    >find sub {
    >my $name = $_;
    >return if -d;
    >my $zip = Archive::Zip->new();
    >die "Error reading $name:$!" unless $zip->read("$name") == AZ_OK;
    >$zip->extractTree();
    >
    >}, $dir;
    Geoff Cox, Dec 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin
    Replies:
    4
    Views:
    1,033
    David Bolen
    Jul 7, 2003
  2. Replies:
    9
    Views:
    682
    Abhijit Soman
    Jan 6, 2005
  3. Vishnu
    Replies:
    0
    Views:
    494
    Vishnu
    Jan 6, 2005
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,661
    Smokey Grindel
    Dec 2, 2006
  5. Yary H
    Replies:
    0
    Views:
    118
    Yary H
    Oct 3, 2004
Loading...

Share This Page