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

Thanks: 2,290
Thanked 1,949 Times in 1,027 Posts
Default

Question to pose here:

Let's say I have a directory that contains subdirectories that I would like to zip in such a way that each subdirectory has its own zip file. Is there a way to do this with a script? I know I could do this manually but I would rather be able to just run the script

What I have so far:

[HIGH]#!/bin/bash
WORK=/path/to/work/directory
SUBDIR=$1
ls -l $WORK/$SUBDIR > ~/listing
list="cat ~/listing | wc -l"
for d in $list; do
zip -r $d.zip $WORK/$SUBDIR/$d
done[/HIGH]

Something's obviously wrong with this though as it doesn't do what I want it to do
__________________
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 online now  
Reply With Quote