Create zip without including directories


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Create zip without including directories
# 1  
Old 04-16-2009
Create zip without including directories

Hi guys,

I'm trying to do the following:

zip -r /tmp/foo.zip public/accounts/foo

But the zip that's been made has the whole "public/accounts/foo" path. I want only the foo folder to be zipped. How can I do this? Thanks,

Elías
# 2  
Old 04-16-2009
Code:
$ cd public/accounts/foo ; zip -r /tmp/foo.zip . ; cd -

Or take a look at the man page of your version of zip if it has a switch similar to tars -C
# 3  
Old 04-16-2009
Quote:
Originally Posted by pludi
Code:
$ cd public/accounts/foo ; zip -r /tmp/foo.zip . ; cd -

Or take a look at the man page of your version of zip if it has a switch similar to tars -C
I'll prefer no to use cd, just make the zip file from the current directory.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Create zip file from root owned fstab

I want to zip up my fstab file for backup purposes. This does not work because of permission issues. cd /etc/ zip -u fstab.zip fstab Can I use this with zip? echo xxx | sudo -S or change fstab owner to me? (3 Replies)
Discussion started by: drew77
3 Replies

2. Shell Programming and Scripting

create a zip file

Im fairly new to bash but I wanted to know about an idea I had to stream my file process these days. I modify .html, and .xml files and usually will take the files right click, create .zip, add files, rename, and cut the zip out of the folder and paste into another folder. I KNOW bash should be... (13 Replies)
Discussion started by: graphicsman
13 Replies

3. Shell Programming and Scripting

Find file and zip without including directory path

Does anyone know of a way to zip the resulting file from a find command? My approach below finds the file and zips the entire directory path, which is not what I need. After scanning the web, it seems to be much easier to perform gzip, but unfortunately the approach must use zip. find `$DIR`... (5 Replies)
Discussion started by: koeji
5 Replies

4. Shell Programming and Scripting

Zip all the files including directories - subdirectories

Hi, Is is possible to zip a folder and all its contents within the folder ( including sub-directories and files) into a zip file? and can regain the same structure if unzipped? Thanks (6 Replies)
Discussion started by: rudoraj
6 Replies

5. UNIX for Dummies Questions & Answers

dircmp without including sub-directories

I have 2 directories I want to compare for like files. One directory has 2 subdirectories associated with it, the other directory does not. When I do the dircmp -s I should get only a few files different between the two directories. I do, but the directory with subdirectories prints out all these... (3 Replies)
Discussion started by: MissI
3 Replies

6. Linux

How to create zip file without path?

Hello, I have generated a PHP script that creates files needed for EPUB file. I have a temp directory where these files are created into and then needs to be zipped. The directory structure is: mimetype content.opf index.html stylesheet.css toc.ncx META-INF META-INF/container.xml ... (4 Replies)
Discussion started by: spaze
4 Replies

7. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

8. Shell Programming and Scripting

To write a shell script which groups files with certain pattern, create a tar and zip

Hi Guru's, I have to write a shell script which groups file names based upon the certain matching string pattern, then creates the Tar file for that particular group of files and then zips the Tar file created for the respective group of files. For example, In the given directory these files... (3 Replies)
Discussion started by: rahu_sg
3 Replies

9. UNIX for Dummies Questions & Answers

tar, zip multiple separate directories and move the results to another volume

TIA, I'm using FreeBSD 6 I have a series of Directories (A,B,C,...Z). Each directory has files and other directories within it. I want to compress the contents of each top directory into a single file so that I get an archive of each directory (for example, A.gzip) AND and want to move... (5 Replies)
Discussion started by: jccbin
5 Replies

10. UNIX for Dummies Questions & Answers

Zip a folder including its sub-folders.

Hi, I have a folder that contains a few sub-folders. I would like to zip that folder and KEEP the subfolders. What it does at the moment is taking all the files within the subfolders and zipping them into one big file (zip -r ...). Does anyone know the UNIX command to keep the subfolders in the... (3 Replies)
Discussion started by: gdog
3 Replies
Login or Register to Ask a Question