Bash script for uncompressing multiple files at a once

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have a set of files:



lium3@l128-37:/DATA/fr94/01 $ ls -l
total 7784
-rw-r--r-- 1 lium3 mcm1 395575 May 2 1996 fr940104.0z
-rw-r--r-- 1 lium3 mcm1 113815 May 2 1996 fr940104.1z
-rw-r--r-- 1 lium3 mcm1 186333 May 2 1996 fr940104.2z
-rw-r--r-- 1 lium3 mcm1 164854 May 2 1996 fr940105.0z
-rw-r--r-- 1 lium3 mcm1 39677 May 2 1996 fr940105.1z
-rw-r--r-- 1 lium3 mcm1 284948 May 2 1996 fr940105.2z


I wish to uncompress them all at once (this is just a sample!).



I tried this



find -name '*.0z' -exec sh -c 'uncompress "$1%.*" "$1"' _ ;


and just got:



gzip: ./fr940125.gz: No such file or directory
gzip: ./fr940125.0z: unknown suffix -- ignored
gzip: ./fr940106.gz: No such file or directory
gzip: ./fr940106.0z: unknown suffix -- ignored


I have many directories with files like these.



If I can get a script to do one directory, is it possible to do it recursively down through the directories?







share|improve this question























    up vote
    2
    down vote

    favorite












    I have a set of files:



    lium3@l128-37:/DATA/fr94/01 $ ls -l
    total 7784
    -rw-r--r-- 1 lium3 mcm1 395575 May 2 1996 fr940104.0z
    -rw-r--r-- 1 lium3 mcm1 113815 May 2 1996 fr940104.1z
    -rw-r--r-- 1 lium3 mcm1 186333 May 2 1996 fr940104.2z
    -rw-r--r-- 1 lium3 mcm1 164854 May 2 1996 fr940105.0z
    -rw-r--r-- 1 lium3 mcm1 39677 May 2 1996 fr940105.1z
    -rw-r--r-- 1 lium3 mcm1 284948 May 2 1996 fr940105.2z


    I wish to uncompress them all at once (this is just a sample!).



    I tried this



    find -name '*.0z' -exec sh -c 'uncompress "$1%.*" "$1"' _ ;


    and just got:



    gzip: ./fr940125.gz: No such file or directory
    gzip: ./fr940125.0z: unknown suffix -- ignored
    gzip: ./fr940106.gz: No such file or directory
    gzip: ./fr940106.0z: unknown suffix -- ignored


    I have many directories with files like these.



    If I can get a script to do one directory, is it possible to do it recursively down through the directories?







    share|improve this question





















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I have a set of files:



      lium3@l128-37:/DATA/fr94/01 $ ls -l
      total 7784
      -rw-r--r-- 1 lium3 mcm1 395575 May 2 1996 fr940104.0z
      -rw-r--r-- 1 lium3 mcm1 113815 May 2 1996 fr940104.1z
      -rw-r--r-- 1 lium3 mcm1 186333 May 2 1996 fr940104.2z
      -rw-r--r-- 1 lium3 mcm1 164854 May 2 1996 fr940105.0z
      -rw-r--r-- 1 lium3 mcm1 39677 May 2 1996 fr940105.1z
      -rw-r--r-- 1 lium3 mcm1 284948 May 2 1996 fr940105.2z


      I wish to uncompress them all at once (this is just a sample!).



      I tried this



      find -name '*.0z' -exec sh -c 'uncompress "$1%.*" "$1"' _ ;


      and just got:



      gzip: ./fr940125.gz: No such file or directory
      gzip: ./fr940125.0z: unknown suffix -- ignored
      gzip: ./fr940106.gz: No such file or directory
      gzip: ./fr940106.0z: unknown suffix -- ignored


      I have many directories with files like these.



      If I can get a script to do one directory, is it possible to do it recursively down through the directories?







      share|improve this question











      I have a set of files:



      lium3@l128-37:/DATA/fr94/01 $ ls -l
      total 7784
      -rw-r--r-- 1 lium3 mcm1 395575 May 2 1996 fr940104.0z
      -rw-r--r-- 1 lium3 mcm1 113815 May 2 1996 fr940104.1z
      -rw-r--r-- 1 lium3 mcm1 186333 May 2 1996 fr940104.2z
      -rw-r--r-- 1 lium3 mcm1 164854 May 2 1996 fr940105.0z
      -rw-r--r-- 1 lium3 mcm1 39677 May 2 1996 fr940105.1z
      -rw-r--r-- 1 lium3 mcm1 284948 May 2 1996 fr940105.2z


      I wish to uncompress them all at once (this is just a sample!).



      I tried this



      find -name '*.0z' -exec sh -c 'uncompress "$1%.*" "$1"' _ ;


      and just got:



      gzip: ./fr940125.gz: No such file or directory
      gzip: ./fr940125.0z: unknown suffix -- ignored
      gzip: ./fr940106.gz: No such file or directory
      gzip: ./fr940106.0z: unknown suffix -- ignored


      I have many directories with files like these.



      If I can get a script to do one directory, is it possible to do it recursively down through the directories?









      share|improve this question










      share|improve this question




      share|improve this question









      asked Jun 7 at 16:05









      Meijuan

      111




      111

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448462%2fbash-script-for-uncompressing-multiple-files-at-a-once%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448462%2fbash-script-for-uncompressing-multiple-files-at-a-once%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)