zip files without .DS_Store and __MACOSX

zip files without .DS_Store and __MACOSX

96

Whenever you have to zip and share files, you probably don’t want to include the .DS_Store file and __MACOSX folder in the zip file.

What are these files for?

The .DS_Store (Desktop Service Store) is a hidden file containing attributes of its enclosing folder, such as the icon size display. The __MACOSX folder is created during the zip process and contains metadata about the compressed files.

How to exclude .DS_Store and __MACOSX from the zip file?

The zip command has a -x parameter that excludes a file or folder of a certain pattern from the resulting zip file. Additionally, the -x parameter can be declared multiple times in order to accomplish multiple exclusions. For instance, to exclude both .DS_Store file and __MACOSX folder, simply run:

zip -r my_compressed_file.zip path/to/folder -x "*.DS_Store" -x "__MACOSX"

To compress all the contents of path/to/folder directory to the my_compressed_file.zip file.

- Last updated 5 months ago

Ads

Be the first to leave a comment.

You must login to leave a comment