# ZIP fie with no mac hidden files



## aicul (Apr 27, 2008)

Hello,

Does anyone know how to create a zip file without the hidden files that mac generates (for example .DS_Store)

I need this to send a clean zip of marketting material to customers that are ... unfortunately.. PC based.

Any ideas - that does not require use of a PC?


----------



## simbalala (Apr 27, 2008)

BlueHarvest

You can set it to prevent saving .DS_Store files or use it to clean folders or disks after the fact. I use it to prevent saving .DS_Store files to Linux web servers.


----------



## simbalala (Apr 27, 2008)

Another basic way is to open the folder in Terminal and do &#8220;ls -al&#8221;.

You&#8217;ll see all the . files, then you can just &#8220;rm&#8221; them.

But be aware that any folder within the archive like parent/child/subchild will show up as parent:child:subchild to your PC users.

To make it simple for myself I just upload to a Linux webserver and do the zipping there if it&#8217;s a complex file structure.


----------



## aicul (Apr 28, 2008)

Thanks for your response Simbalala, 

Although blueharvest seems to work, the fact that it is always active is a little painful because I don't want hidden files removed from all .zip files.

Your idea about the unix option seems better, I will work with it once I have done some further testing.

Thanks again


----------



## Mikuro (Apr 28, 2008)

I recommend CleanArchiver, a free zip program that has an option to exclude .ds_store files (without deleting them from your system).

There's also ZipCleaner, which takes zip files created with the Finder and strips out .ds_store files and other Mac-specific data.


----------



## simbalala (Apr 28, 2008)

aicul said:


> Thanks for your response Simbalala,
> 
> Although blueharvest seems to work, the fact that it is always active is a little painful because I don&#8217;t want hidden files removed from all .zip files.


BlueHarvest doesn&#8217;t remove .DS_Store unless you explicitly drag a folder or disk of some kind (memory cards included) into that prefs panel. In your case you drag the folder you wish to zip over the cleaner icon then zip it.

I got it the day it was announced because I was tired of having .DS_Store files cluttering up my hosted Linux web servers, that&#8217;s my primary use, it prevents them from being transferred and that&#8217;s why it needs to be constantly active. At the time nothing else was available but now I see from Mikuro&#8217;s post that some other options are available, ZipCleaner might be just what you need.


----------



## simbalala (Apr 28, 2008)

I was posting somewhat complex zip files containing php code. Folders within folders.

PC users complained that they opened them and found the folder structure within the archive that should look like parent/child/subchild showing up as parent:child:subchild. So instead of a hierarchical structure they were just seeing many files at the top level with long, confusing filenames.

The Mac does not use / internally it uses a :, I understood what was going on but PC users were baffled and complaining. To get around the problem I starting zipping on my Linux webservers using ssh, upload the folder then zip it there.

Mikuro, do you know of a way which would solve this problem locally?


----------



## Natobasso (Apr 28, 2008)

Get Parallels or Bootcamp?


----------



## simbalala (Apr 28, 2008)

Natobasso said:


> Get Parallels or Bootcamp?


umm, on a G4?


----------



## Natobasso (Apr 28, 2008)

umm, didn't see your comp. 

Virtual PC? 

Can you post a screenshot of your directory structure/folder names? Maybe your names are too long? I do know you're dealing with the mac has 2 directory forks and the pc only 1 issue...


----------



## simbalala (Apr 28, 2008)

Natobasso said:


> umm, didn&#8217;t see your comp.
> 
> Virtual PC?


I&#8217;m not going to spend any money on this when I have a viable solution using the web server. I think others may benefit from any solution though.

I can&#8217;t give you a screenshot because I don&#8217;t have a PC here but you can see for yourself. Set up a dummy folder with a couple more inside, nest them. Add some files inside each folder and zip up the top level folder. Move the zip to a PC and unzip it.

Edit: There is actually a PC here but it belongs to my sister. So if I did anything at all techie with it and a meteor came crashing through the roof destroying it I&#8217;d get the blame.


----------



## Mikuro (Apr 28, 2008)

That problem sounds vaguely familiar, but I've never encountered it myself. Are you sure that still happens with Tiger and Leopard? I don't think I ever used it much in Panther. Back then I used StuffIt to make zips.

Then again, I guess it's possible the people I give zips to just never complained about it.   This problem happens on both Windows and Linux?


----------



## simbalala (Apr 28, 2008)

I&#8217;ve been on the sending side, I&#8217;ve never seen the actual result, I don&#8217;t really know the people who&#8217;ve complained.

It&#8217;s a public site with a library of routines and I&#8217;ve been told of the problem. It does make sense, we do know that Apple does use colons internally. Try putting one in a file name or just ask an app to give you the HFS path to a file, it&#8217;s like so: 
	
	



```
Computer:Users:myname:Desktop:test.jpg
```

Edit: I&#8217;m on Tiger and the problems have been reported while I&#8217;ve been on Tiger. I was zipping using the contextual menu when the problem was reported, I don&#8217;t know if the result is the same when using the command line in Terminal. I just wanted to eliminate the problem for sure so I switched to the safe haven of the Linux webserver.

Anyone here running a dual boot OS X/Windows system or with a Windows PC at hand can check this for us.


----------



## fulmar2 (May 28, 2008)

There is an inexpensive program that does just what you are asking.  It creates a ZIP file with no hidden mac files.  It's really easy to use (drag and drop).  I use it every day!  It seems to stumble when there are certain characters in the filenames - but other than that, a solid application.


----------



## bondibox (Apr 25, 2009)

You could use the terminal's zip program to "exclude" those files.  From the man page:



> zip -r foo foo -x \*.o
> which will include the contents of foo in foo.zip while excluding all the files  that  end  in .o.   The  backslash avoids the shell filename substitution, so that the name matching is performed by zip at all directory levels.


Some other examples would be
(#exclude .DS_Store files) zip -r archive.zip myprojectdirectory -x \.DS_Store
(#exclude subversion files) zip -r archive.zip myprojectdirectory -x \.svn
(#exclude all hidden files) zip -r archive.zip myprojectdirectory -x \.*


----------

