Your errors fall into two categories.

1. Gunzip won't do anything with files that don't have the correct extension, so running gunzip on the file 'cns061206' (for example) doesn't work. If you want to uncompress something that doesn't have a .gz extension, try zcat cns061206 > newfilename instead.

2. You are attempting to compress files that already have a .gz extension, so gzip won't try and compress it again. Without more details, I would guess that either you didn't unzip these files in the first part of the program, or that some external system has continued to create new .gz files in the directory while you were processing.

Depending on what kind of processing you are doing, you might want to consider taking a better approach than 'unzip everything', 'process everything', 'zip everything'. For example, if you are not actually changing the contents, you can just run 'zcat' on the file and read the output, using something like open( IN, "zcat $file |" ) (or, better yet, something like Compress::Zlib.) If you are modifying the files, you might consider processing them one at a time, rather than a directory at a time, which could avoid problems with new files being created while your program is running.


We're not surrounded, we're in a target-rich environment!

In reply to Re: maddening system call gzip/gunzip problems by jasonk
in thread maddening system call gzip/gunzip problems by neilwatson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.