Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-04-2009, 11:25 PM   #1
Registered: Sep 2009
Posts: 75

Rep: Reputation: 15
how to zip a dir to a different location

can anybody tell me the exact command to zip a dir from the current location to a different location.

currently now i am in cat directory, which contains 15 files.

I need to zip it to a different location say /root/Desktop

i tried this way.

zip -b /root/Desktop ./*

the compressing is successful but it is happening in the same dir.
i could not see any archive folder in /root/Desktop/

-- shravee
Old 11-04-2009, 11:40 PM   #2
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
zip? Hmm. Knew about unzip, didn't know linux distros shipped with zip. Personally I would use tar.

% tar czf /root/Desktop/archivefile.tar.gz ./*

Old 11-04-2009, 11:49 PM   #3
LQ Newbie
Registered: Oct 2009
Posts: 5

Rep: Reputation: 0
exactly zip doesnot supported in tar is compressed file
Old 11-05-2009, 07:04 AM   #4
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Originally Posted by himanshugarg04 View Post
exactly zip doesnot supported in tar is compressed file

zip is available in Linux---but gzip and bzip2 are more common.

tar by itself does not do compression.
Old 11-05-2009, 07:43 AM   #5
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,728
Blog Entries: 27

Rep: Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058

excerpt from 'man zip';

zip - package and compress (archive) files

zip [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [--longoption ...] [-b path] [-n suffixes] [-t date]
[-tt date] [zipfile [file ...]] [-xi list]

zipcloak (see separate man page)

zipnote (see separate man page)

zipsplit (see separate man page)

Note: Command line processing in zip has been changed to support long options and handle all
options and arguments more consistently. Some old command lines that depend on command line
inconsistencies may no longer work.

zip is a compression and file packaging utility for Unix, VMS, MSDOS, OS/2, Windows 9x/NT/XP,
Minix, Atari, Macintosh, Amiga, and Acorn RISC OS. It is analogous to a combination of the Unix
commands tar(1) and compress(1) and is compatible with PKZIP (Phil Katz's ZIP for MSDOS systems).

A companion program (unzip(1L)) unpacks zip archives. The zip and unzip(1L) programs can work
with archives produced by PKZIP (supporting most PKZIP features up to PKZIP version 4.6), and
PKZIP and PKUNZIP can work with archives produced by zip (with some exceptions, notably streamed
archives, but recent changes in the zip file standard may facilitate better compatibility). zip
version 3.0 is compatible with PKZIP 2.04 and also supports the Zip64 extensions of PKZIP 4.5 .....
If indeed you need to use 'zip' then I suggest that you read the 'man zip' pages.



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
[SOLVED] how to zip a dir shravee Linux - Newbie 9 10-28-2009 11:17 PM
What is location of dir autostart for gnome in FC4 nitinmhetre Linux - General 1 01-07-2007 03:30 AM
how to unzip a zip file on a selected dir in linux ? sunlinux Linux - Software 1 06-12-2006 04:52 AM
dir.h io.h location in gcc elena Linux - Software 2 01-18-2005 11:31 AM
zip files turns to dir´s?! Sofia Linux - General 0 02-20-2002 02:26 AM

All times are GMT -5. The time now is 05:03 AM.

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