0

Somebody sent me a bunch of PDF files as a Zip from their Mac laptop. Now I am trying to extract the PDF files.

I am on Windows 10 I can extract a folder __MACOSX and inside it, a folder containing a number of PDF files, but when I see the files in binary, they are not actually in the correct PDF format.

Near the start of the file I see some plain-text insertions, such as ATTR or com.dropbox.attrs and apparently some binary insertions, probably the values of those attributes.

Is this a quirk of Zip? Or were those files originally corrupted, such as when the sender downloaded them from dropbox? Or am I looking in a wrong place?

Isn't the folder __MACOSX where I should look for my files?


NOTE: My question is not heoretic, like what __MACOSX was intended for and why Apple does not use standard file formats.

My question is purely practical: I urgently need the PDF files they sent to me, so how can I extract them in a usable form (not corrupted with those useless "attribute" insertions) (or how can I remove those insertions to repair the PDF files?)

I can imagine that a part of the solution will be to borrow a Mac laptop from somebody and open the Zip there, but I have no idea of how to open it on a Mac. Or, how to transfer them back -- maybe with a USB stick?

Please help with fool-proof step-by-step instructions. If I knew what to do, I would not ask.

Giacomo1968
  • 58,727

1 Answers1

0

You may wish to strip the zip down to just the Windows content as that __MACOSX fork is not needed on Windows.

Beware this cmd script does not do extensive checking but is a template for your own enhancements. You should have a work "copy" of the MAC files in a working folder to avoid problems the adjust the results as you wish.

Here is used with a drag and drop example. The script is in one folder and the VBExample.zip is in its own folder. We can see its subfolders but they are NOT yet unpacked.

enter image description here

Before:
enter image description here

After where the zip is backed up and reduced in size without the fork and as a bonus the unpacked contents are there (can be deleted if you wish):
enter image description here

This script comes with "Zero Guarantee" of working with all Mac zips. It works with the more common variants. Always use on a copy of the one you got. Then delete working copies as desired.

if not exist "%~dpn1.zip" goto EOF
pushd "%~dp1"

copy "%~dpn1.zip" "%~dpn1-backup.zip" tar -xf "%~dpn1.zip" rd /s /q __MACOSX tar -a -cf "%~dpn1.zip" "%~n1*.*"

if not exist "%~dpn1.zip" echo FAILED & pause REM [optionally remove the unpacked folder] RD /S /Q "%~n1"

:exit popd

Reasons for failure may include when a filename does not match the foldername, see the new zip is too small as 1 KB. enter image description here

We can easily rebuild in such case using send to correctly named zip folder. enter image description here enter image description here

Or ensure the outer zip name reflects the inner folder name. enter image description here

Giacomo1968
  • 58,727
K J
  • 1,248