Loading ...
Sorry, an error occurred while loading the content.

Archive Zip appears empty in Windows

Expand Messages
  • twlewis64
    I am using Archive Zip to compress files in a Windows environment. If I open the files through Windows, it shows nothing. I can open the file with 7-zip and
    Message 1 of 9 , Jan 24, 2011
    • 0 Attachment
      I am using Archive Zip to compress files in a Windows environment. If I open the files through Windows, it shows nothing. I can open the file with 7-zip and see the files if go down through the directory layers. Why can't Windows see the files?
      Thanks for any help on this.
      My test code is below:

      #!/usr/local/bin/perl
      use strict;
      use Archive::Zip qw( :ERROR_CODES );

      my $objZip = Archive::Zip->new();
      my $archiveName = 'C:\Temp\files.zip';
      my @files = ('C:\temp\file1.txt',
      'C:\temp\file2.txt',
      'C:\temp\file3.txt'); # files to store

      foreach my $fileName(@files) {
      print "file is $fileName\n";
      $objZip->addFile($fileName); # add file
      }
      if ($objZip->writeToFileNamed($archiveName) != AZ_OK) {
      # write the file to a zip archive. if it fails then
      # write and error to the logfile
      print "Failed to archive file\n";
      } # end of if
    • Hag'i
      ... Hi, Thanks to Shlomi Fish for pointing me to this post. Can you please post the names of the files that were added to the archive? Regards, Alan Haggai
      Message 2 of 9 , Feb 12, 2011
      • 0 Attachment
        --- In perl-beginner@yahoogroups.com, "twlewis64" <twlewis@...> wrote:
        >
        > I am using Archive Zip to compress files in a Windows environment. If I open the files through Windows, it shows nothing. I can open the file with 7-zip and see the files if go down through the directory layers. Why can't Windows see the files?
        > Thanks for any help on this.
        > My test code is below:
        >
        > #!/usr/local/bin/perl
        > use strict;
        > use Archive::Zip qw( :ERROR_CODES );
        >
        > my $objZip = Archive::Zip->new();
        > my $archiveName = 'C:\Temp\files.zip';
        > my @files = ('C:\temp\file1.txt',
        > 'C:\temp\file2.txt',
        > 'C:\temp\file3.txt'); # files to store
        >
        > foreach my $fileName(@files) {
        > print "file is $fileName\n";
        > $objZip->addFile($fileName); # add file
        > }
        > if ($objZip->writeToFileNamed($archiveName) != AZ_OK) {
        > # write the file to a zip archive. if it fails then
        > # write and error to the logfile
        > print "Failed to archive file\n";
        > } # end of if

        Hi,

        Thanks to Shlomi Fish for pointing me to this post.

        Can you please post the names of the files that were added to the archive?

        Regards,
        Alan Haggai Alavi.
        --
        The difference makes the difference
      • Alan Haggai Alavi
        Hi, I have confirmed it to be an Archive::Zip bug. Will reply as soon as I fix it. Regards, Alan Haggai Alavi. -- The difference makes the difference
        Message 3 of 9 , Feb 12, 2011
        • 0 Attachment
          Hi,

          I have confirmed it to be an Archive::Zip bug. Will reply as soon as I
          fix it.

          Regards,
          Alan Haggai Alavi.
          --
          The difference makes the difference
        • Tim Lewis
          Yes. They were two simple text files. In researching this, I found that it may be the way in which Windows looks at zip files.
          Message 4 of 9 , Feb 12, 2011
          • 0 Attachment
            Yes. They were two simple text files. In researching this, I found that it may be the way in which Windows looks at zip files.


            ---- Hag'i <alanhaggai@...> wrote:
            > --- In perl-beginner@yahoogroups.com, "twlewis64" <twlewis@...> wrote:
            > >
            > > I am using Archive Zip to compress files in a Windows environment. If I open the files through Windows, it shows nothing. I can open the file with 7-zip and see the files if go down through the directory layers. Why can't Windows see the files?
            > > Thanks for any help on this.
            > > My test code is below:
            > >
            > > #!/usr/local/bin/perl
            > > use strict;
            > > use Archive::Zip qw( :ERROR_CODES );
            > >
            > > my $objZip = Archive::Zip->new();
            > > my $archiveName = 'C:\Temp\files.zip';
            > > my @files = ('C:\temp\file1.txt',
            > > 'C:\temp\file2.txt',
            > > 'C:\temp\file3.txt'); # files to store
            > >
            > > foreach my $fileName(@files) {
            > > print "file is $fileName\n";
            > > $objZip->addFile($fileName); # add file
            > > }
            > > if ($objZip->writeToFileNamed($archiveName) != AZ_OK) {
            > > # write the file to a zip archive. if it fails then
            > > # write and error to the logfile
            > > print "Failed to archive file\n";
            > > } # end of if
            >
            > Hi,
            >
            > Thanks to Shlomi Fish for pointing me to this post.
            >
            > Can you please post the names of the files that were added to the archive?
            >
            > Regards,
            > Alan Haggai Alavi.
            > --
            > The difference makes the difference
            >
          • Alan Haggai Alavi
            Hi, Fixed the bug. You can checkout the latest code from the Subversion repository at: http://svn.ali.as/cpan/trunk/Archive-Zip/ svn checkout
            Message 5 of 9 , Feb 13, 2011
            • 0 Attachment
              Hi,

              Fixed the bug. You can checkout the latest code from the Subversion
              repository at: http://svn.ali.as/cpan/trunk/Archive-Zip/

              svn checkout http://svn.ali.as/cpan/trunk/Archive-Zip/

              Considering the case that you checked out the code to the directory
              containing the archiving script, modify the script to include:

              ...

              use lib 'Archive-Zip/lib';
              use Archive::Zip qw( :ERROR_CODES );

              ...

              Thanks for the bug report.

              Anything else, please let me know.

              Regards,
              Alan Haggai Alavi.
              --
              The difference makes the difference
            • Tim Lewis
              Thanks Alan! From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Alan Haggai Alavi Sent: Sunday, February 13, 2011 9:42 AM
              Message 6 of 9 , Feb 19, 2011
              • 0 Attachment
                Thanks Alan!



                From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Alan Haggai Alavi
                Sent: Sunday, February 13, 2011 9:42 AM
                To: perl-beginner@yahoogroups.com
                Subject: [PBML] Re: Archive Zip appears empty in Windows





                Hi,

                Fixed the bug. You can checkout the latest code from the Subversion
                repository at: http://svn.ali.as/cpan/trunk/Archive-Zip/

                svn checkout http://svn.ali.as/cpan/trunk/Archive-Zip/

                Considering the case that you checked out the code to the directory
                containing the archiving script, modify the script to include:

                ...

                use lib 'Archive-Zip/lib';
                use Archive::Zip qw( :ERROR_CODES );

                ...

                Thanks for the bug report.

                Anything else, please let me know.

                Regards,
                Alan Haggai Alavi.
                --
                The difference makes the difference





                [Non-text portions of this message have been removed]
              • Tim Lewis
                I have come across a strange happening in some code. The code below is a stripped out version of my entire program, but it still does the same weird thing. If
                Message 7 of 9 , Mar 16, 2011
                • 0 Attachment
                  I have come across a strange happening in some code. The code below is a stripped out version of my entire program, but it still does the same weird thing. If the code below is run, it gives me the error
                  String found where operator expected at testme.pl line 16, near "case "1""
                  (Do you need to predeclare case?)
                  syntax error at testme.pl line 15, near ") {"
                  Execution of testme.pl aborted due to compilation errors.

                  If I remove the very last line, the code works fine. It also works if I comment out the line that contains division: $monthOfArchiveDataInt = int($calculatedMonthCheck/12);
                  The server in which the code runs is Perl 5.8.8.
                  I also tested the code on Perl 5.10.1, and it works fine in that environment.
                  I already have fixed the code by changing to "if" statements instead of a switch. I was just wondering if someone knows the reason for this quirk. On a similar note, I think I remember reading that switch statements are going out of style, and being replace with if/else. Is that true?


                  #!/usr/local/bin/perl
                  use strict;
                  use Switch;

                  my $deleteParameterIn = "5";
                  my $currentSystemDate = "20110315";
                  my ($currentCalculatedMonth,$calculatedMonthCheck,$monthOfArchiveDataInt,
                  $yearOfMonths,$numberOfMonth,$archiveMonthName);
                  # Get the current month as number since year 1
                  $currentCalculatedMonth = (((substr($currentSystemDate,0,4)) * 12) + (substr($currentSystemDate,4,2)));
                  $calculatedMonthCheck = $currentCalculatedMonth - $deleteParameterIn;
                  $monthOfArchiveDataInt = int($calculatedMonthCheck/12);
                  $yearOfMonths = $monthOfArchiveDataInt * 12;
                  $numberOfMonth = $calculatedMonthCheck - $yearOfMonths;
                  switch ($numberOfMonth) {
                  case "1" { $archiveMonthName = "JAN"; }
                  case "2" { $archiveMonthName="FEB"; }
                  case "3" { $archiveMonthName="MAR"; }
                  case "4" { $archiveMonthName="APR"; }
                  case "5" { $archiveMonthName="MAY"; }
                  case "6" { $archiveMonthName="JUN"; }
                  case "7" { $archiveMonthName="JUL"; }
                  case "8" { $archiveMonthName="AUG"; }
                  case "9" { $archiveMonthName="SEP"; }
                  case "10" { $archiveMonthName="OCT"; }
                  case "11" { $archiveMonthName="NOV"; }
                  case "12" { $archiveMonthName="DEC"; }
                  }
                  print "am is $archiveMonthName\n";
                  # $logFile=~s//~//~~~~//g;
                • Charles K. Clarkson
                  ... Why use switch() at all? my @month_names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC /; my $archiveMonthName = $month_names[$numberOfMonth - 1];
                  Message 8 of 9 , Mar 19, 2011
                  • 0 Attachment
                    On 3/16/2011 8:59 AM, Tim Lewis wrote:

                    > I have come across a strange happening in some code. The code below is
                    > a stripped out version of my entire program, but it still does the
                    > same weird thing. If the code below is run, it gives me the error

                    > String found where operator expected at testme.pl line 16, near "case "1""

                    Why use switch() at all?

                    my @month_names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC /;
                    my $archiveMonthName = $month_names[$numberOfMonth - 1];



                    Charles Clarkson
                    --
                    Mobile Home Investor
                    Free Market Advocate
                    Programmer

                    I'm not really a smart person. I just play one on the Internet.

                    Stephenville, TX
                    http://twitter.com/CharlesClarkson
                    +1 (254) 968-8328
                  • Tim Lewis
                    Charles, that is excellent code, and much easier than IF statements. Thanks! Tim From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On
                    Message 9 of 9 , Mar 19, 2011
                    • 0 Attachment
                      Charles, that is excellent code, and much easier than IF statements. Thanks!

                      Tim





                      From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Charles K. Clarkson
                      Sent: Saturday, March 19, 2011 11:04 AM
                      To: perl-beginner@yahoogroups.com
                      Subject: Re: [PBML] Strange behavior with switch statement





                      On 3/16/2011 8:59 AM, Tim Lewis wrote:

                      > I have come across a strange happening in some code. The code below is
                      > a stripped out version of my entire program, but it still does the
                      > same weird thing. If the code below is run, it gives me the error

                      > String found where operator expected at testme.pl line 16, near "case "1""

                      Why use switch() at all?

                      my @month_names = qw/ JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC /;
                      my $archiveMonthName = $month_names[$numberOfMonth - 1];

                      Charles Clarkson
                      --
                      Mobile Home Investor
                      Free Market Advocate
                      Programmer

                      I'm not really a smart person. I just play one on the Internet.

                      Stephenville, TX
                      http://twitter.com/CharlesClarkson
                      +1 (254) 968-8328





                      [Non-text portions of this message have been removed]
                    Your message has been successfully submitted and would be delivered to recipients shortly.