Using Terminal to encrypt a zip file in sequoia on my MacBook Air M2

I was able to password my zip file, which is on my desktop, with Terminal. When I did that and now open it, it seems to zip the folders before getting to the actual pdf document.

eg. it zipped Users/Me/Desktop/ file.pdf (3 clicks to see file)

I put the zip file up in Google Drive, and when I open it, it shows the same way. ie; 3 folders to click on, to get to the pdf file.


  1. Will others see it that way too when they open the password protected zip file?
  2. Is there a command so it doesn't show like this? I want only the file zipped so one click.

MacBook Air (M2, 2022)

Posted on Oct 29, 2024 1:01 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 29, 2024 4:08 PM

If you want just the PDF involved and not the directories, consider encrypting the PDF itself:

Password-protect a PDF in Preview on Mac - Apple Support


If you don’t want the directories, either set Finder to the folder, or use the command-line zip after using the cd command to change your default directory to the directory where the PDF resides.


Rather than

-j
--junk-paths

you can also use an available zip switch to exclude the directories:

-D
--no-dir-entries


The zip encryption is weak, if that matters to you.


16 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using Terminal to encrypt a zip file in sequoia on my MacBook Air M2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.