views:

45

answers:

3

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.

+3  A: 

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
fatcat1111
I c. So the -j command just ignore the directory path, only put the file name in the current folder?
Simon Guo
That is correct.
fatcat1111
A: 

-j is "*J*unk pathnames"

Mark Baker
A: 

in that case it won't do anything special.

but if, for example you type

C:\programs\zip -j myzipfile directory1

and directory1 contains subdirectories, all the files you zip, when extracted, will be put in the same directory, regardless what subdirectory they were in originally.

klez
"When extraction" makes sense. Thx.
Simon Guo