View Single Post
Old September 16th, 2013, 02:37 PM   #919 (permalink)
Sunny Vacation Supporter!
palmtree5's Avatar
Join Date: May 2012
Location: USA
Gender: Male
Posts: 3,652
Device(s): HTC One SV, Samsung Galaxy Prevail (retired), Nexus 7 (Gen 1)
Carrier: Boost Mobile

Thanks: 2,392
Thanked 2,097 Times in 1,108 Posts

Originally Posted by MoodyBlues View Post
I just slapped something together, but I'm not 100% sure it's exactly what you're after.

From your snippet, it looks like you want to hard-code the working directory, then at runtime you want to manually enter the name of a subdirectory to zip, correct? Is that actually how you want it? If so...ignore the following!

This--as it stands right now--has nothing hard-coded, meaning it can be run in any directory, and it automatically finds all of its subdirectories, and zips each one as its own subdirectory-named zip file in its own subdirectory. Obviously, this can be tweaked as far as location of the zipped files, whether or not you enter a directory/subdirectory name, and so on:

for SUBDIR in `ls -d1 */` 
do ZIPFILE=`basename $SUBDIR`
Any questions about what's doing what, just ask.
The way the directories are is my work directory has subdirectories for each section. In those subdirectories are the directories that need to be zipped in such a way that each of those directories is its own zip file. What you gave me works if I was trying to include the entire section in one zip.
Find a post helpful? Hit
See spam or something offensive? Hit
New to the site? Site Rules/Guidelines and Introductions
Not a member yet but want to join? Join here!
Want to chat with staff?Here
Want to chat with mods?Here
palmtree5 is offline  
Reply With Quote