LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to zip several files to several zip with one command? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-zip-several-files-to-several-zip-with-one-command-786397/)

thomas2004ch 02-02-2010 05:31 AM

How to zip several files to several zip with one command?
 
Assumed I have following files:

test1.txt
test2.txt

What I want is I want to zip these files with one command so it looks after that:

test1.txt.zip
test2.txt.zip

pixellany 02-02-2010 05:43 AM

Code:

for filename in *; do zip $filename; done
first, try the zip command by itself to be sure you know how it works

You might also be able to do:

Code:

zip *

thomas2004ch 02-08-2010 01:59 AM

Quote:

Originally Posted by pixellany (Post 3849390)
Code:

for filename in *; do zip $filename; done
first, try the zip command by itself to be sure you know how it works

You might also be able to do:

Code:

zip *

I don't understand what you said here, especially your code. How to run it?

evo2 02-08-2010 02:10 AM

Type it into a terminal.

Evo2.

thomas2004ch 02-08-2010 08:13 AM

I solved the problem. It's easy.

gzip test*

I got:

test1.txt.gz
test2.txt.gz

That's what I want.


All times are GMT -5. The time now is 12:44 AM.