LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-04-2009, 11:25 PM   #1
shravee
Member
 
Registered: Sep 2009
Posts: 84

Rep: Reputation: 16
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-04-2009, 11:40 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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-04-2009, 11:49 PM   #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, 07:04 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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, 07:43 AM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:09 PM.

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
Open Source Consulting | Domain Registration