UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old October 26th, 2004, 12:54 PM
stargoo stargoo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 stargoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Newbie ksh script help

I need a ksh script that will make tar files of a list of directories. my problem is that I need a single tarball for each directory. the tarball needs to have the same name as the directory with the .tar.Z extension.
I'm thinking I need to make an array with the names of the directories and then feed each of them through tar, but I'm not sure of how to do this.

In case you're wondering why I need this, each directory is a separate job. Each job is tarred by itself and then when i have enough to fill up a dvd, i backup.

thanks

Reply With Quote
  #2  
Old October 26th, 2004, 02:32 PM
stargoo stargoo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 stargoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
got it

thanks anyways, figured it out with a for loop

#! /bin/ksh


for foo in $(ls);do
if [[ -d $foo ]];then
tar -cfZ $foo.tar $foo



done

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Newbie ksh script help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway