How to unzip multiple files at once?

How to unzip multiple files at once?

Post by Adrien Blais » Fri, 04 Feb 2000 04:00:00



Hello -- I apologize in advance if this is not the proper place to ask this
question.

I need to unzip dozens of files witin one dir on my UNIX server (Linux)

I tried to cd to that dir and run:

unzip *.ZIP or unzip ./*.ZIP

But all I get is

"caution: filename not matched: [filename]"

for each file...

(All my files are in upper case)

I tried with several options and couldn't get it to work.

Unzipping files one at a time does work though...

Any clue on how to unzip multiple files at once? Thanks in advance.

-- AB

 
 
 

How to unzip multiple files at once?

Post by Rainer Temm » Fri, 04 Feb 2000 04:00:00



> I need to unzip dozens of files witin one dir on my UNIX server (Linux)

> I tried to cd to that dir and run:

> unzip *.ZIP or unzip ./*.ZIP

> But all I get is

> "caution: filename not matched: [filename]"

> for each file...

> (All my files are in upper case)

> I tried with several options and couldn't get it to work.

> Unzipping files one at a time does work though...

> Any clue on how to unzip multiple files at once? Thanks in advance.

Hi Adrien,

try this:

for name in *.ZIP
do
   unzip $name
done

Regards Rainer

 
 
 

How to unzip multiple files at once?

Post by bmar.. » Fri, 04 Feb 2000 04:00:00



   >Hello -- I apologize in advance if this is not the proper place to
   >ask this question.
   >I need to unzip dozens of files witin one dir on my UNIX server
   >(Linux)
   >I tried to cd to that dir and run:
   >unzip *.ZIP or unzip ./*.ZIP
   >But all I get is
   >"caution: filename not matched: [filename]"
   >for each file...
   >(All my files are in upper case)
   >I tried with several options and couldn't get it to work.
   >Unzipping files one at a time does work though...
   >Any clue on how to unzip multiple files at once? Thanks in advance.
for file in *.ZIP; do unzip $file; done

Net-Tamer V 1.08X - Test Drive

 
 
 

How to unzip multiple files at once?

Post by Adrien Blais » Sat, 05 Feb 2000 04:00:00


Hi Rainer, thanks for your answer.

It worked great. Now what I would like is to have, for each given archive
file, a new dir created, with the same file name (no extension) and the
content of the given archive into the new directory.

So the content of archive1.zip would be extracted into a new archive1 dir.

Any idea of how I can do that?

Thanks again.

-- Adrien



>> I need to unzip dozens of files witin one dir on my UNIX server (Linux)

>> I tried to cd to that dir and run:

>> unzip *.ZIP or unzip ./*.ZIP

>> But all I get is

>> "caution: filename not matched: [filename]"

>> for each file...

>> (All my files are in upper case)

>> I tried with several options and couldn't get it to work.

>> Unzipping files one at a time does work though...

>> Any clue on how to unzip multiple files at once? Thanks in advance.

>Hi Adrien,

>try this:

>for name in *.ZIP
>do
>   unzip $name
>done

>Regards Rainer

 
 
 

How to unzip multiple files at once?

Post by Rainer Temm » Sat, 05 Feb 2000 04:00:00



> Hi Rainer, thanks for your answer.

> It worked great. Now what I would like is to have, for each given archive
> file, a new dir created, with the same file name (no extension) and the
> content of the given archive into the new directory.

> So the content of archive1.zip would be extracted into a new archive1 dir.

> Any idea of how I can do that?

Hi Adrien,

try this:

for name in *.ZIP
do
   OIFS=$IFS; IFS="."; set $name; shortname=$1; IFS=$OIFS;
   mkdir $shortname
   cd $shortname
   unzip ../$name
   cd ..
done

Regards Rainer

 
 
 

How to unzip multiple files at once?

Post by Adrien Blais » Sat, 05 Feb 2000 04:00:00


Hi Rainer, it worked like a charm!

Many thanks.

-- Adrien

<...>

Quote:>Hi Adrien,

>try this:

>for name in *.ZIP
>do
>   OIFS=$IFS; IFS="."; set $name; shortname=$1; IFS=$OIFS;
>   mkdir $shortname
>   cd $shortname
>   unzip ../$name
>   cd ..
>done

>Regards Rainer

 
 
 

How to unzip multiple files at once?

Post by Chri » Sat, 05 Feb 2000 04:00:00


hmmm...are there any more requirements?:) Try this:
Tested it here with compressed source files. Substitute with ZIP and or
whatever you have.

for name in `ls *.Z`
do
#echo ${name} |  sed "s/.c.Z//"
echo "mkdir ` echo ${name} |  sed "s/.c.Z//"`"
#echo ${newdir}
echo uncompress ${name} ` echo ${name} |  sed "s/.c.Z//"`
done
HTH,
Krishna


> Hi Rainer, thanks for your answer.

> It worked great. Now what I would like is to have, for each given archive
> file, a new dir created, with the same file name (no extension) and the
> content of the given archive into the new directory.

> So the content of archive1.zip would be extracted into a new archive1 dir.

> Any idea of how I can do that?

> Thanks again.

> -- Adrien



> >> I need to unzip dozens of files witin one dir on my UNIX server (Linux)

> >> I tried to cd to that dir and run:

> >> unzip *.ZIP or unzip ./*.ZIP

> >> But all I get is

> >> "caution: filename not matched: [filename]"

> >> for each file...

> >> (All my files are in upper case)

> >> I tried with several options and couldn't get it to work.

> >> Unzipping files one at a time does work though...

> >> Any clue on how to unzip multiple files at once? Thanks in advance.

> >Hi Adrien,

> >try this:

> >for name in *.ZIP
> >do
> >   unzip $name
> >done

> >Regards Rainer