![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| zipping all the tar files to singlr file in directory | prakash.gr | UNIX for Dummies Questions & Answers | 2 | 01-06-2009 03:51 PM |
| Script for zipping a file | jayaramanit | Shell Programming and Scripting | 4 | 08-06-2008 07:47 AM |
| Help me While zipping the file | Jolly | UNIX for Advanced & Expert Users | 7 | 05-11-2007 11:05 AM |
| Limitations of a file size for zipping | ramky79 | AIX | 1 | 01-19-2007 10:23 PM |
| count file(s) under a specific directory | leemjesse | Shell Programming and Scripting | 6 | 03-23-2005 11:18 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
zipping a directory when the file count is over $X
Hiya,
I've been plugging away at this script and I cant get it to behave as I need. first off it fails to adhere to the conditions of the file limit, and zips the directory regardless of the file count and secondly, but less important it zips up the entire path not just the directory I'm after. Been at this for hours and I could use a hand. tired in glasgow Code:
#!/bin/bash
location_Parent=/path/Parent
location_IMG=/path/IMG
location_AUD=/path/AUD
time_a=20090614-205534
echo zipping and deleting dupes
IMG_CNT_MAX=1000
cd $location_IMG
FILECOUNT=$(ls | wc -l)
if [ $FILECOUNT < $IMG_CNT_MAX ]
then
echo "zipping and deleeting dupes";
cd $location_Parent
tar -zcvf $time_a-IMG.tar.gz $location_IMG
tar -zcvf $time_a-AUD.tar.gz $location_AUD
wait
rm -r $location_IMG
rm -r $location_AUD
else
echo "Number of files has not yet reached $IMG_CNT_MAX, not ready to archive";
fi
|
| Bookmarks |
| Tags |
| zip |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|