4

Our organisation receives zip files from Mac users which contain a ._ file in addition to the file we expect. In the past this was due to resource fork and data fork encoding limitations on other file systems. So for example, when we expect a submission that looks like this:

README.md
src/mysite.html
src/myscript.js

we generally receive a zip that contains files such as:

._README.md
README.md
src/._mysite.html
src/mysite.html
src/._myscript.js
src/myscript.js

This makes it difficult for us to process these files automatically. What instructions should we give to our Mac users to suppress these files we can’t process or handle?

4
  • 2
    Technical correction: these are not actually resource forks; they're AppleDouble files that store various filesystem metadata that can't be stored natively in the zip archive format. Resource forks used to be the main type of data that got stored in this format, but they're almost never used these days. The AppleDouble files you're seeing are almost certainly storing things like extended attributes, not resource forks. – Gordon Davisson Mar 4 at 19:13
  • @GordonDavisson thanks - that is good to know. One question I have is. Do these double files appear along side every file in MacOS, or are the only added when compressed into a zip? – Alex Spurling Mar 5 at 12:28
  • 1
    Alex, your follow on question would be best asked as a follow on question. I’ve edited this to focus on the suppression of filesystem preserving files that get added and decompressed from zip archives. I think a lot of people will benefit from your questions. Keep asking them, but try to ask one question per question. – bmike Mar 5 at 12:30
  • @AlexSpurling They're only used in volume/archive formats that don't natively support complex metadata (i.e. not macOS's native HFS+ or APFS volumes). See: Why are dot underscore ._ files created, and how can I avoid them? – Gordon Davisson Mar 5 at 18:50
4

There's no native way to automatically exclude resource forks or other extended attribute and filesystem metadata during compression, but many 3rd party apps can do it. These files contain filesystem data that should be preserved and you get a valuable signal that you have lost data when your process strips or ignores these files.

One such is Keka (donationware, ie free direct download, paid from App Store)

enter image description here

0
3

No, it is not possible to prevent the creation of resource fork files - the native zip function is designed to preserve this filesystem specific data so you would need to instruct your team to use a different tool or process.

It will likely be easier to improve your tooling to ignore files it knows are safe to ignore than to force a change in the behaviour of your users.

dot_clean on macOS

Instead, clean the files before ingesting them with macOS's dot_clean:

For each dir, dot_clean recursively merges all ._* files with their corresponding native files according to the rules specified with the given arguments. By default, if there is an attribute on the native file that is also present in the ._ file, the most recent attribute will be used.

find on Linux

On Linux, use find to recursively remove all the matching files:

find  . -type f -name '\._*' -exec rm {} \;
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .