LinuxQuestions.org
Visit Jeremy's Blog.
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 11-05-2009, 12:25 AM   #1
shravee
Member
 
Registered: Sep 2009
Posts: 75

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


hi,
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 archivefile.zip ./*


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-05-2009, 12:40 AM   #2
evo2
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 ./*

Evo2.
 
Old 11-05-2009, 12:49 AM   #3
himanshugarg04
LQ Newbie
 
Registered: Oct 2009
Posts: 5

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

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by himanshugarg04 View Post
exactly zip doesnot supported in linux....so tar is compressed file
What??

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

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

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Quote:
excerpt from 'man zip';

NAME
zip - package and compress (archive) files

SYNOPSIS
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.

DESCRIPTION
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.

 
  


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


All times are GMT -5. The time now is 08:52 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration