ZippiingFiles_NoPath.

I am using this command to  zip html files created by a web application.

http://www.ehow.com/how_5056873_create-zip-file-unix.html




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.
sam15Asked:
Who is Participating?
 
Christopher Raymond MendozaConnect With a Mentor Commented:
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

or
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

0
 
Christopher Raymond MendozaCommented:

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

Open in new window

0
 
sam15Author Commented:
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.
0
 
Christopher Raymond MendozaCommented:
Does /myapp/prd/ contain additional subfolders?
0
 
sam15Author Commented:
/myapp/prd/ has subfolder.

actually i am sing /myapp/prd/orders/

which does not have any subfolders now
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.