How to zip files from different folders into one archive on a Mac
Finder’s Compress command works on items that sit together in one window, so the usual answer is to gather the files into one folder first and compress that folder. If you would rather leave every file exactly where it is, a single Terminal command can pull files from several folders into one zip without moving anything.
Why Compress will not reach across folders
Select something in Finder, right-click, and choose Compress, and a zip appears beside the originals. Compress one file and the zip is named after it. Compress a folder and you get a zip with the folder’s name. Compress several items at once and the result is called Archive.zip.
What Compress needs is a single selection, and an ordinary Finder window shows one folder at a time. A lease PDF in Documents, a receipt in Downloads and a photo on the desktop cannot be selected together, so there is no one selection to compress. You have to bring them together first, or go around Finder.
Method one: gather into a folder, then compress
- Make a folder where the archive should end up. On the desktop, right-click and choose New Folder, or press Shift-Command-N in any Finder window. Name the folder what you want the zip to be called, such as “Lease documents”.
- Put each file into it. A plain drag between folders on the same drive moves the file. Hold Option as you drop to copy it instead, so the original stays where it was.
- When everything is inside, right-click the folder and choose Compress “Lease documents”. A file called Lease documents.zip appears beside it.
- If you copied the files in step 2, you can throw away the gathering folder once the zip is made. The originals are untouched.
Compressing the folder puts the folder itself inside the archive, so whoever opens it gets one tidy folder. If you would rather the files sit loose at the top level, open the folder, press Command-A to select everything, and compress the selection. That makes Archive.zip inside the folder, which you can rename and move.
If two files share a name, such as two scans both called scan.pdf, Finder asks what to do when the second one arrives. Choose Keep Both and it renames the newcomer. When Finder says an item with the same name already exists goes through each choice.
Method two: one Terminal command, nothing moves
This route leaves every file in its own folder and builds the zip from all of them.
- Open Terminal from Applications > Utilities.
- Type
zip -jfollowed by a space, then the path of the archive you want to make, then another space. For a zip on the desktop, that iszip -j ~/Desktop/bundle.zipwith a space at the end. - Drag each file from Finder into the Terminal window. Each drop types that file’s full path, with any spaces escaped and a space after it.
- Press Return.
The finished command looks something like this:
zip -j ~/Desktop/bundle.zip ~/Documents/lease.pdf ~/Downloads/deposit\ receipt.pdf ~/Desktop/meter.jpg
The -j option stores only the file names, not the folders they came from, so the person opening the archive sees the files side by side. Without it, each file would be stored under its full folder path, starting with Users and your account name, which is rarely what you want to send.
Three things to know:
- Duplicate names stop it. If two of the files have the same name,
zip -jrefuses rather than guess. Rename one of them and run the command again. - Running it again adds to the archive. Use the same archive name with a new file, and zip adds that file to the existing archive.
- It is built for files. For whole folders, method one is simpler.
If paths in Terminal are new to you, paths with spaces in the terminal, and how to avoid trouble explains the backslashes.
What the recipient will see
A zip made on a Mac opens on any common computer. Archives made by Finder can carry a few hidden macOS files that appear as a folder called __MACOSX when opened elsewhere. They are harmless, and people can ignore or delete them.
Do not expect a much smaller file. Photos, video and most PDFs are already compressed, so a zip of them will be close to their combined size. The value of the zip is that it is one file: one attachment, one upload, one thing to download. How to drag a folder instead of a file on a Mac covers why so many upload fields want exactly that.
Gathering the files without the back and forth
The slow part of method one is not compressing, it is the gathering: open a folder, find the file, drag it to the new folder, go back for the next one, find the new folder again. It is worse when some of the files are not in Finder at all but in a mail message or a browser’s download list.
Ledge takes the running around out of it. As you come across each file, drag it up to the notch at the top of the screen and let go; it lands on a shelf that drops from the notch and stays there. When the set is complete, make your folder, open the shelf with Option-Space or a click on the notch, and drag everything down onto the folder at once. Then compress it as usual.
Dropped on a Finder folder, the files themselves move there. That suits the common case where the scattered files belong together anyway and you want them filed and zipped in one pass. If each file should stay where it lives, use the Terminal method, which never moves anything, or duplicate a file first with Command-D and shelf the copy.
The finished zip can go back on the shelf too. Drop it on a chat app and it uploads as a file; drop it on a terminal and it arrives as its path. Ledge has no account and no cloud, so nothing leaves the Mac until you send it.
Questions
Why is my zip barely smaller than the files inside it?
Most of the files were already compressed. Photos, video and PDFs usually shrink very little. The zip still turns many files into one, which is often the real goal.
Can I add a file to a zip I already made?
Not in Finder. Double-click the zip to expand it, add the file to the folder, and compress again. In Terminal, run zip -j with the same archive name and the new file, and it is added.
Can I put a password on the zip?
Finder’s Compress has no password option. If the contents are sensitive, it is safer to send them through something built for private sharing than to rely on a password on the archive.