Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 8, 2008, 09:48 AM   #1
flashuni
macrumors newbie
 
Join Date: Jun 2008
Zip Command Help!

I am trying to preserve the resource forks in font files while zipping them.
The font files are in folders, and I am trying to zip each folder up individually and not just into one big archive.

What is the zip parameter to do this?
flashuni is offline   0 Reply With Quote
Old Jun 8, 2008, 11:26 AM   #2
numero
macrumors member
 
Join Date: Jul 2002
Location: OR
Give this a try.

Code:
ls -d /path/to/your/parent/dir | sed 's/^/"/;s/$/"/' | xargs -I {} -n1 zip -r {}.zip {}
-numero
numero is offline   0 Reply With Quote
Old Jun 8, 2008, 11:51 AM   #3
flashuni
Thread Starter
macrumors newbie
 
Join Date: Jun 2008
Thanks

Thanks a bunch, but your script makes my fonts folder into one big archive.

Is their any way that I could do this piece of code to each folder inside on my fonts folder. When I ran it, it just created a large archive of my whole fonts folder and didn't just zip up each folder individually inside of the fonts folder.

Thanks, Flashuni

For Example Here is my previous script that doesnt work:
## zip the contents of each folder in the current directory into an archive:
for d in *; do if [ -d "$d" ]; then cd "$d"; cd ..; fi; done

## zip every folder in the current directory into an archive:
for d in *; do if [ -d "$d" ]; then zip -r -j "$d.zip" "$d"; fi; done

## example recursively forces the deletion of the directory if zip returns true:
for d in *; do
if [ ! -d "$d" ]; then
continue
fi
if ! zip -R -j "$d.zip" "$d"; then
continue
fi

Last edited by flashuni; Jun 8, 2008 at 12:01 PM.
flashuni is offline   0 Reply With Quote
Old Jun 8, 2008, 03:58 PM   #4
motulist
macrumors 68040
 
motulist's Avatar
 
Join Date: Dec 2003
I'd just use automator.
motulist is offline   0 Reply With Quote
Old Jun 8, 2008, 04:16 PM   #5
flashuni
Thread Starter
macrumors newbie
 
Join Date: Jun 2008
Quote:
Originally Posted by motulist View Post
I'd just use automator.
I have tried that, but if someone could point me in the right direction it would be a great help!

Thanks, Flashuni
flashuni is offline   0 Reply With Quote
Old Jun 8, 2008, 05:04 PM   #6
numero
macrumors member
 
Join Date: Jul 2002
Location: OR
To fix the problem with your fonts dir being zipped do this

Code:
ls -d /path/to/your/parent/dir/* | sed 's/^/"/;s/$/"/' | xargs -I {} -n1 zip -r {}.zip {}
I added the "/*" to the parent dir path.

What you want fed into the sed command is the list of directories that will be zipped. Do just the "ls -d /path/to/parent/dir/*" command by hand and see if that gives you the folders that you want individually zipped.

Sorry about that little slip. You are just feeding something in that is one level too high. It should work with this change.

-numero
numero is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Iomega Zip drives Stormz Mac Peripherals 14 Mar 16, 2011 10:06 AM
Option and Command Moves windows help Ratstroke Mac Basics and Help 4 Nov 22, 2010 11:04 AM
Damaged stuffit zip file. Help! BLewisMaltz Mac Applications and Mac App Store 11 Mar 9, 2006 01:27 AM
Quick US zip code help! stevehaslip Community 38 Apr 26, 2005 02:21 PM
zip drive help skullsdontfade Macintosh Computers 5 Feb 12, 2004 12:29 PM


All times are GMT -5. The time now is 04:15 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC