Posted on 2011-10-11
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/  /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
    LVL 4

    Expert Comment

    by:Christopher Raymond Mendoza

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

    Open in new window


    Author Comment

    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.
    LVL 4

    Expert Comment

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

    Author Comment

    /myapp/prd/ has subfolder.

    actually i am sing /myapp/prd/orders/

    which does not have any subfolders now
    LVL 4

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
    Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Video by: Phil
    This video goes over how to configure and start a jail in FreeBSD.  This video is meant to supplement the article included with this course.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now