|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
macrumors regular
Join Date: Jan 2003
Location: New York
|
create zip file without .ds_store files??
I created a zip file using OS X, which is meant to be used cross-platform. I unzipped it in Windows, and I see all these ugly .DS_store and __MACOSX folders. I do not want these hidden files in my ZIP, since they are not hidden or useful for Windows.
Any tools or options I can use to not include these files when creating a ZIP? |
|
|
|
|
|
#2 |
|
macrumors Demi-God
Join Date: Jun 2005
|
Use this Applescript in an Automator workflow and save the plug-in to the Finder to access it in the Finder contextual menu:
Code:
global parentFolder
set selUnixPaths to {}
set tempDir to quoted form of POSIX path of (path to temporary items folder as text)
set itemsUnixPaths to ""
tell application "Finder"
set finderSelection to selection
set parentFolder to (container of (item 1 of finderSelection as alias))
if (length of finderSelection) > 1 then
repeat with selectedItem in finderSelection
copy quoted form of ("./" & (name of (selectedItem as alias))) to end of selUnixPaths
end repeat
repeat with selectedItem in selUnixPaths
if itemsUnixPaths = "" then
set itemsUnixPaths to selectedItem
else
set itemsUnixPaths to itemsUnixPaths & " " & selectedItem
end if
end repeat
set archivename to my checkName("Archive.zip")
else
set itemsUnixPaths to quoted form of ("./" & name of (item 1 of finderSelection as alias))
set namewitoutext to my trimext((item 1 of finderSelection) as alias)
set archivename to my checkName(namewitoutext & ".zip")
end if
end tell
set shellScript to "cd " & quoted form of (POSIX path of (parentFolder as alias)) & "; zip -b " & tempDir & " -9r '" & archivename & "' " & itemsUnixPaths & " -x *.DS_Store"
with timeout of 60 * 60 seconds
do shell script shellScript
end timeout
on trimext(myfile)
tell application "Finder"
set fileextlenght to count of ((name extension of (myfile)) as text)
set fileName to name of (myfile)
end tell
if fileextlenght > 0 then
return (items 1 thru -(fileextlenght + 2) of fileName) as string
else
return fileName
end if
end trimext
on checkName(archiveFile)
tell application "Finder"
if exists file (((parentFolder as alias) as string) & archiveFile) then
set fileName to (items 1 thru -5 of archiveFile)
set x to 2
repeat while exists file (((parentFolder as alias) as string) & archiveFile)
set archiveFile to fileName & " " & x & ".zip"
set x to x + 1
end repeat
end if
return archiveFile
end tell
end checkName
|
|
|
|
|
|
#3 |
|
Thread Starter
macrumors regular
Join Date: Jan 2003
Location: New York
|
wow. that Automater script looks like a complete mess! it must have taken a long time. Automater has always been a mystery to me, and I am a programmer, so thats saying something. thanks so much for sharing this!
|
|
|
|
|
|
#4 |
|
macrumors Demi-God
Join Date: Jun 2005
|
Hah. Sorry. I did not write the script but, it took some digging around to find it. And again, you're welcome.
|
|
|
|
|
|
#5 |
|
macrumors regular
Join Date: Jul 2005
Location: Glasgow, Scotland
|
You can also use Stuffit in the contextual menu to archive to .zip, and in the settings you can choose to ignore finder files.
|
|
|
|
| indiekiduk |
| View Public Profile |
| Find More Posts by indiekiduk |
|
|
#6 |
|
macrumors newbie
Join Date: Jun 2008
|
Yemuzip
Or you can simply use "Yemuzip" available for free. You can choose to zip to "windows" style (yeah the first time ever mac sucks). The hidden files mac file system puts everywhere cause so much trouble especially when you just want to do a simple FTP transfer. Just a plain simple file transfer, my web server was ruined.
|
|
|
|
|
|
#7 |
|
macrumors 6502a
Join Date: Nov 2007
|
Here's the automator workflow that I use. I'm not sure if it's a duplicate of TheSpaz's
http://mikepiontek.com/software/mac/...n-archive.html
__________________
Macbook C2D - late '07: 2.2GHz, 4GB RAM, 120GB HD, Intel GMA X3100 Running latest Mac OS 10.6.x update |
|
|
|
| pjrobertson |
| View Public Profile |
| Find More Posts by pjrobertson |
|
|
#8 |
|
macrumors 68000
Join Date: Feb 2006
|
Why take sixty lines to do one simple command?
Code:
find ~ -name \.DS_Store -print0 | xargs -0 rm |
|
|
|
|
|
#9 |
|
macrumors 68030
|
I use the Terminal...
Code:
cd [directory] zip -r [filename].zip *
__________________
Scribbls - a collaborative drawing community designed to combine drawings into outcomes—no talent required.
|
|
|
|
|
|
#10 |
|
macrumors newbie
Join Date: Jun 2008
|
Simple Utility
Why use the terminal when you can use the finder?
Here is a simple drag-and-drop application that will give you the zip files without the DS_Store and __MACOSX. |
|
|
|
|
|
#11 | |
|
macrumors newbie
Join Date: Jun 2008
|
Yemuzip is for FREE!
But Yemuzip is for FREE!!!
Quote:
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|