LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-02-2010, 05:31 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 497

Rep: Reputation: 31
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
 
Old 02-02-2010, 05:43 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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 *
 
Old 02-08-2010, 01:59 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 497

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by pixellany View Post
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?
 
Old 02-08-2010, 02:10 AM   #4
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,237

Rep: Reputation: 1128Reputation: 1128Reputation: 1128Reputation: 1128Reputation: 1128Reputation: 1128Reputation: 1128Reputation: 1128Reputation: 1128
Type it into a terminal.

Evo2.
 
Old 02-08-2010, 08:13 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 497

Original Poster
Rep: Reputation: 31
I solved the problem. It's easy.

gzip test*

I got:

test1.txt.gz
test2.txt.gz

That's what I want.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP ZIP MYSQL - open zip without writing it to disk benjalien Programming 2 01-15-2010 05:14 AM
download only zip files using wget command Fond_of_Opensource Linux - Newbie 1 08-09-2006 03:47 AM
Zip gives error "-bash: /usr/bin/zip: Argument list too long" konathamsrinu Programming 3 07-06-2006 10:08 AM
How to Unzip 2 Zip files through one single command sumitarun Linux - Newbie 2 03-23-2005 08:00 AM
create a self-extracting zip file with zip on solaris? samsolaris Solaris / OpenSolaris 3 10-15-2004 01:50 AM


All times are GMT -5. The time now is 02:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration