From 0dca47f464000584b83200e004ceadfc70a735fb Mon Sep 17 00:00:00 2001 From: TheK4n Date: Wed, 29 Jun 2022 13:45:36 +0300 Subject: [PATCH] add func split-file --- sub/bash/functions | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sub/bash/functions b/sub/bash/functions index 1881d92..2d9aba7 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -191,4 +191,14 @@ open() { nohup xdg-open $1 1>/dev/null 2>&1 & } +split-file() { + local _size + test -z "$2" && _size=1G || _size="$2" + test -e "$1" || return 1 + + test -d "$1" && \ + (mkdir "$1.tar.gz.splitted" && cd "$1.tar.gz.splitted" && tar -cz "../$1" | split -d -b "$_size") || \ + (mkdir "$1.splitted" && cd "$1.splitted" && split -d -b "$_size" "../$1") +} +