Problem with zip command..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem with zip command..
# 1  
Old 09-20-2009
Problem with zip command..

Hi friends

I am working in cygwin. Currently I am in root directory(C). I want to zip only the files from a diretory "A" to a new directory 1.zip in root directory C.
I am using the following command:
$: zip 1.zip A/*
but it is zipping the entire directory itself, But what I want is when I unzip 1.zip I should get
file1
file2 etc...
instead of
A/file1
A/file2 etc..
I really appreciate your help if you can help me in modify the above command so that I can get one of my script done on 100's of directories like A.

Thanks in advance..
# 2  
Old 09-20-2009
Code:
cd A
zip 1.zip *

# 3  
Old 09-21-2009
Hi Scrutinizer,

I want the command to work with out doing cd to the respective directory I am interested. I mean I don't want to use cd A . I hope you understood my problem.
# 4  
Old 09-21-2009
Code:
zip -j 1.zip A/*

'man zip' is a useful resource too.
# 5  
Old 09-23-2009
Thanks Pludi,

It worked very well. I regret to my innocence and negligence for not looking deep into the zip command manual.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question regarding zip command

Hi, I wish to zip a folder with only those files which have ".properties" extension while excluding all other file extensions be it in the same folder or sub-folder. Can you help me with how can get that to work ? (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Shell Programming and Scripting

Zip data using Command

HI Guys, I using below command to zip data but in zip file i have entire path of source. zip $HOME/EM/ZIPData/All.tar.gz /vr/rt/on/mg/set/XM/Swor/xt/0300*.* In Zip file i have entire path vr/rt/on/mg/set/XM/Swor/xt/ I just want file data zip in may target location (2 Replies)
Discussion started by: pareshkp
2 Replies

3. UNIX for Dummies Questions & Answers

How to use zip command in AIX?

hi i am not able to use zip command in aix. getting below error zip abc.zip ksh: zip: not found. oslevel 5.3.0.0 (4 Replies)
Discussion started by: scriptor
4 Replies

4. Shell Programming and Scripting

Grep on zip file problem

Hi All, I'm stuck with this issue when I try to display the searched string into a compressed file. More exactly when I run this script for f1 in $(find dir1 -type f -print); do gunzip -c $f1 | grep -n "gio" | awk -F":" '{print $1-1 "," $1 "p"}' | xargs -i sed -n {} $f1 ; done returns... (3 Replies)
Discussion started by: gio1234
3 Replies

5. Shell Programming and Scripting

Problem in piping the file(s) content from zip files

Hi friends I have a zip file 1.zip which contains three text files a.txt b.txt c.txt I want to grep some text(keyword) in those 3 files without extracting all the three files to a local directoryusing the command, unzip -p 1.zip |grep "search text" >result.txt The Output file is... (2 Replies)
Discussion started by: ks_reddy
2 Replies

6. Shell Programming and Scripting

zip code filter problem using AWK need help

Hello all; I have a large file (csv file) with addresses. I am trying to filter out specific entries based on zip code from a particular column of data. However my awk statement can not account for zipcode that begins with a certain pattern. It finds the pattern anywhere within the zipcode. ... (3 Replies)
Discussion started by: nelsonsierra
3 Replies

7. UNIX for Dummies Questions & Answers

Zip command (zip folder doesn't include a folder of the same name)

Hi guys, I have a question about the zip command. Right now I have a directory with some files and folders on it that I want to compress. When I run the zip command: zip foo -r I am getting a foo.zip file that once I unzip it contains a foo folder. I want to create the foo.zip, but that... (1 Reply)
Discussion started by: elioncho
1 Replies

8. Shell Programming and Scripting

ZIP Problem

Hi Folks, i have a script to zip certain files. redirecting the successfully zipped files and unsuccessful files to seperate files. i found unzipped file name in zipped file list. i dont know why it happened. and, some of the files are not zipped. i checked the previllege also, even... (2 Replies)
Discussion started by: Arunprasad
2 Replies

9. Shell Programming and Scripting

zip command

Hi All, I have the following requirement. Source file Products_Extract.dat contains <CTRL M > characters and hence is in DOS format. I zip this file using zip command in UNIX BOX as follows: find . -name Products_Extract.dat|zip Target.zip -@ Next I ftp (in Binary MODE) this output zip... (3 Replies)
Discussion started by: sureshg_sampat
3 Replies

10. UNIX for Dummies Questions & Answers

zip command

Hello, What is the appropriate command to zip a folder that contain sub folder and files? Example: Folder lunaa In the folder there are a number of folder e.g 01526, etc...which contains number of file. Any idea would be grateful. Many thanks (1 Reply)
Discussion started by: su_in99
1 Replies
Login or Register to Ask a Question