add func split-file

This commit is contained in:
TheK4n 2022-06-29 13:45:36 +03:00
parent 138556ac16
commit 0dca47f464

View File

@ -191,4 +191,14 @@ open() {
nohup xdg-open $1 1>/dev/null 2>&1 & 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")
}