Bash script for uncompressing multiple files at a once

Clash 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?
shell-script compression
add a comment |Â
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?
shell-script compression
add a comment |Â
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?
shell-script compression
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?
shell-script compression
asked Jun 7 at 16:05
Meijuan
111
111
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password