Compressing folders on a mac, without the .DS_Store
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Flying Over Ancient Lands
--
Chapters
00:00 Compressing Folders On A Mac, Without The .Ds_store
00:31 Answer 1 Score 2
01:15 Answer 2 Score 3
01:53 Accepted Answer Score 132
02:51 Answer 4 Score 4
03:17 Thank you
--
Full question
https://superuser.com/questions/198569/c...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#macos #compression #zip
#avk47
ACCEPTED ANSWER
Score 132
If you do not mind jumping down in to terminal, then this is pretty darn easy. If you are in /Users/username
, which is your $HOME directory and there is a subdirectory named foo that you want to zip but ignore all .DS_Store files, then do the following:
zip -r foo.zip foo -x "*.DS_Store"
To interpret this, we are running the zip executable with the following parameters/arguments:
-r
for recursively including all directories underneath the targets we want to zip.foo.zip
is the name of the zip archive we are creatingfoo
is the target directory we want to zip up-x "*.DS_Store"
excludes all files whose path ends in the string ".DS_Store"
No goofy third party applications needed nor do you need to trash your .DS_Store files at all - just rely on all of the unix tool goodness built right in to OSX / Darwin.
ANSWER 2
Score 4
If you've already created the zip archive (or want a simple way of removing .DS_Store post zip creation), this will remove all .DS_Store files at any path in the zip archive:
zip -d archive.zip "*/*.DS_Store"
whaley's answer is still definitely the best, because it can be aliased and forgotten about. In my case, I created the zip from the Archive Utility, then realized I should delete these.
ANSWER 3
Score 3
I don't think there's a way to do it by default, but there's two ways I can think of to achieve what you want.
First off, I found a free app called FolderWasher. Drop the folder on the app and it'll remove the .DS_Store files and zip it for you.
Alternatively (and potentially better than 3rd party software) you can use Automator to clean the archive after creation. There is actually already an action created for this. That's only one extra step, and you can drag the action to Finder so it's easy to find.
ANSWER 4
Score 2
Open Terminal (/Applications/Utilies/Terminal.app) and run the following command to show hidden files:
defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
To hide the hidden files simply run:
defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder
You can delete .DS_Store files just like any other files without causing any harm to your directory. As stated on wikipedia, "DS_Store (Desktop Services Store) is a hidden file created by Apple Inc.'s Mac OS X operating system to store custom attributes of a folder such as the position of icons or the choice of a background image."