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

zip -r /usr/bin/zip /myapp/prd/  /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.
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/ /myapp/prd/orders/file1.html /myapp/prd/orders/file2.html

Open in new window

zip -j /myapp/prd/ /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/ orders/
rm -rf orders/

Open in new window

Christopher Raymond MendozaCommented:

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

Open in new window

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

actually i am sing /myapp/prd/orders/

which does not have any subfolders now
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.