Sha256: 6c20a0b5ee54cfa2258301207ce883989d7a8cd0c41637d83b20d208155e5c69

Contents?: true

Size: 779 Bytes

Versions: 26

Compression:

Stored size: 779 Bytes

Contents

#!/usr/bin/env bash

target_dir=$1

if [ -d "$target_dir" ]; then
    echo "Will Compress files in dir: $target_dir"
else
    echo "Given directory does not exist!"
    exit 1
fi

gzip_bin=`which gzip`

if [ -x "$gzip_bin" ]; then
    echo "You have gzip!"
else
    echo "No Gzip found!"
    exit 1
fi

for target_file in $(ls $target_dir); do
    if [[ "$target_dir/$target_file" == *".gz" ]]; then
        echo "skip: $target_dir/$target_file"
    else
        if [ -f "$target_dir/$target_file.gz" ]; then
            echo "gz exists: $target_file ~> $target_dir/$target_file.gz"
        else
            echo "compress: $target_dir/$target_file > $target_dir/$target_file.gz"
            gzip -c $target_dir/$target_file > $target_dir/$target_file.gz
        fi
    fi
done

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
ix-cli-0.0.6 bin/ix-gzip-dir
ix-cli-0.0.5 bin/ix-gzip-dir
ix-cli-0.0.4 bin/ix-gzip-dir
ix-cli-0.0.3 bin/ix-gzip-dir
ix-cli-0.0.2 bin/ix-gzip-dir
ix-cli-0.0.1 bin/ix-gzip-dir