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.27 bin/ix-gzip-dir
ix-cli-0.0.26 bin/ix-gzip-dir
ix-cli-0.0.25 bin/ix-gzip-dir
ix-cli-0.0.24 bin/ix-gzip-dir
ix-cli-0.0.23 bin/ix-gzip-dir
ix-cli-0.0.22 bin/ix-gzip-dir
ix-cli-0.0.21 bin/ix-gzip-dir
ix-cli-0.0.20 bin/ix-gzip-dir
ix-cli-0.0.19 bin/ix-gzip-dir
ix-cli-0.0.18 bin/ix-gzip-dir
ix-cli-0.0.17 bin/ix-gzip-dir
ix-cli-0.0.16 bin/ix-gzip-dir
ix-cli-0.0.15 bin/ix-gzip-dir
ix-cli-0.0.14 bin/ix-gzip-dir
ix-cli-0.0.13 bin/ix-gzip-dir
ix-cli-0.0.12 bin/ix-gzip-dir
ix-cli-0.0.11 bin/ix-gzip-dir
ix-cli-0.0.10 bin/ix-gzip-dir
ix-cli-0.0.9 bin/ix-gzip-dir
ix-cli-0.0.7 bin/ix-gzip-dir