Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux zip doesn't maintain directory structure [closed]

I have a directory I am trying to zip on Linux before sending it to Windows.

I thought it worked with this command:

zip -r directory.zip directory

However when I looked at the directory it contained only the files, no folders. It's as if the -j command is the default, which is confusing.

I looked in the manual and I could not see any means of forcing it to maintain the directory structure in the zip.

Any ideas?

like image 659
Tom Avatar asked Jan 27 '26 13:01

Tom


1 Answers

It was an unzipping issue, not a zipping issue. The unzip command required -d to maintain the directory structure.

wzunzip -d directory.zip 
like image 124
Tom Avatar answered Jan 29 '26 05:01

Tom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!