Posted on 2011-10-11
Medium Priority
Last Modified: 2012-05-12
I am using this command to  zip html files created by a web application.


zip -r /usr/bin/zip /myapp/prd/file1.zip  /myapp/prd/file1.html /myapp/prd/file2.html

The file is created on unix and i ftp it to windows PC.

The problem is that when i unzip the file, it has the /myapp/prd/ path and it creates those folders on the client.

Is there a way to remove this path from the zip file?

I use the path in the zip command because I run it as an oracle user so i am not in that directory where the files are.
Question by:sam15
  • 3
  • 2

Expert Comment

by:Christopher Raymond Mendoza
ID: 36953539

cd /myapp/prd/
zip -r file1.zip file1.html file2.html

Open in new window


Author Comment

ID: 36953572
i am trying to avoid the CD command because i run this from pl/sql using java routine.
is not there an option not to include the path specified for location of zip file.

Actually i am not sure if it is picking up he path from the individual files or the zip file specified.

Expert Comment

by:Christopher Raymond Mendoza
ID: 36953665
Does /myapp/prd/ contain additional subfolders?

Author Comment

ID: 36953693
/myapp/prd/ has subfolder.

actually i am sing /myapp/prd/orders/

which does not have any subfolders now

Accepted Solution

Christopher Raymond Mendoza earned 2000 total points
ID: 36953735
The thing with zip is that it stores relative paths.

If there are no subfolders you could probably use
zip -j /myapp/prd/file1.zip /myapp/prd/orders/file1.html /myapp/prd/orders/file2.html

Open in new window

zip -j /myapp/prd/file1.zip /myapp/prd/orders/*

Open in new window


If there are subfolders, you could probably copy the whole folder to your home folder, zip it, then remove the copy. It is something like:
cp -r /myapp/prd/orders/ ./
zip -r /myapp/prd/file1.zip orders/
rm -rf orders/

Open in new window


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question