Search code examples
command-linezip

zip -j command, what does the -j option mean?


Wondering what is the -j option mean in the zip command. I found the explanation as following:

-j
Store just the name of a saved file (junk the path), and do not store directory names. By default, zip will store the full path (relative to the current path).

But not quite sure what it is exact mean? Can anyone explain it using the following command as an example?

C:\programs\zip -j myzipfile file1 file2 file3

Thank you.


Solution

  • This will make more sense with a different example:

    C:\programs\zip myzipfile a/file1 b/file2 c/file3
    

    Normally this would result in a zip containing three "subdirs":

    a/
    + file1
    
    b/
    + file2
    
    c/
    + file3
    

    With -j, you get:

    ./
    + file1
    + file2
    + file3